@onecx/angular-accelerator 4.14.0 → 4.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -150,18 +150,29 @@ class SrcDirective {
150
150
  }
151
151
  set ocxSrc(value) {
152
152
  if (value && this._src !== value) {
153
- this.httpClient.get(value, { responseType: 'blob' }).subscribe({
154
- next: (blob) => {
155
- const url = URL.createObjectURL(blob);
156
- this.el.nativeElement.onload = () => {
157
- URL.revokeObjectURL(url);
158
- };
159
- this.el.nativeElement.src = url;
160
- },
161
- error: () => {
162
- this.el.nativeElement.src = 'error';
163
- },
164
- });
153
+ try {
154
+ if (new URL(value, window.location.origin).origin === window.location.origin) {
155
+ this.httpClient.get(value, { responseType: 'blob' }).subscribe({
156
+ next: (blob) => {
157
+ const url = URL.createObjectURL(blob);
158
+ this.el.nativeElement.onload = () => {
159
+ URL.revokeObjectURL(url);
160
+ };
161
+ this.el.nativeElement.src = url;
162
+ },
163
+ error: () => {
164
+ this.el.nativeElement.src = 'error';
165
+ },
166
+ });
167
+ }
168
+ else {
169
+ this.el.nativeElement.src = value;
170
+ }
171
+ }
172
+ catch (error) {
173
+ console.log('Cannot parse URL ', value, error);
174
+ this.el.nativeElement.src = value;
175
+ }
165
176
  this._src = value;
166
177
  }
167
178
  }
@@ -2878,7 +2889,7 @@ class AppConfigService {
2878
2889
  }
2879
2890
  init(baseUrl) {
2880
2891
  return new Promise((resolve, reject) => {
2881
- const loadConfigPromise = firstValueFrom(this.http.get(baseUrl + 'assets/env.json'));
2892
+ const loadConfigPromise = firstValueFrom(this.http.get(Location.joinWithSlash(baseUrl, 'assets/env.json')));
2882
2893
  loadConfigPromise
2883
2894
  .then(async (config) => {
2884
2895
  if (config) {