diff --git a/src/lib/feature/feature-details/feature-details.component.html b/src/lib/feature/feature-details/feature-details.component.html index d82905a6c8..2e87f06fa1 100644 --- a/src/lib/feature/feature-details/feature-details.component.html +++ b/src/lib/feature/feature-details/feature-details.component.html @@ -1,4 +1,4 @@ - +
@@ -10,12 +10,6 @@ {{ 'igo.targetHtmlUrl' | translate }} {{feature.title}} - - - - @@ -29,3 +23,4 @@
- - {{property.key }}
+ diff --git a/src/lib/feature/feature-details/feature-details.component.ts b/src/lib/feature/feature-details/feature-details.component.ts index a3ab16b718..0dfebc852e 100644 --- a/src/lib/feature/feature-details/feature-details.component.ts +++ b/src/lib/feature/feature-details/feature-details.component.ts @@ -1,6 +1,6 @@ import { Component, Input, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; - +import { DomSanitizer } from '@angular/platform-browser'; import { Feature } from '../shared'; @Component({ @@ -19,8 +19,11 @@ export class FeatureDetailsComponent { } private _feature: Feature; - constructor(private cdRef: ChangeDetectorRef) { } + constructor(private cdRef: ChangeDetectorRef, private sanitizer: DomSanitizer) { } + isUrl(value) { + return this.sanitizer.bypassSecurityTrustResourceUrl(value); + } isObject(value) { return typeof value === 'object'; } diff --git a/src/lib/query/shared/query.service.ts b/src/lib/query/shared/query.service.ts index 4c8f949ea1..6f9bb192d8 100644 --- a/src/lib/query/shared/query.service.ts +++ b/src/lib/query/shared/query.service.ts @@ -149,14 +149,14 @@ export class QueryService { const clickx1 = clickx + threshold * 2; const clicky1 = clicky + threshold * 2; - const wkts = 'POLYGON((' + clickx + ' ' + clicky + ', ' + clickx + ' ' + clicky1 + + const wkt_poly = 'POLYGON((' + clickx + ' ' + clicky + ', ' + clickx + ' ' + clicky1 + ', ' + clickx1 + ' ' + clicky1 + ', ' + clickx1 + ' ' + clicky + ', ' + clickx + ' ' + clicky + '))'; const format = new ol.format.WKT(); - const yourGeometry = format.readFeature(wkts); - const f = (yourGeometry.getGeometry() as any); + const tenPercentWidthGeom = format.readFeature(wkt_poly); + const f = (tenPercentWidthGeom.getGeometry() as any); let target_igo2 = '_blank'; let icon_html = 'link'; @@ -172,16 +172,19 @@ export class QueryService { case 'innerhtml': target_igo2 = 'innerhtml'; icon_html = 'place'; - const pos_body_debut = res['_body'].toLowerCase().indexOf(''); - const pos_body_fin = res['_body'].toLowerCase().lastIndexOf('') + 7; - res['_body'] = res['_body'].slice(pos_body_debut, pos_body_fin); + const body_tag_start = res['_body'].toLowerCase().indexOf(''); + const body_tag_end = res['_body'].toLowerCase().lastIndexOf('') + 7; + // replace \r \n and ' ' with '' to validate that the body is really empty. + if ( res['_body'].replace(/ /g, '') + .replace(/(?:\r\n|\r|\n)/g, '' ) + .slice(body_tag_start, body_tag_end) + .replace(' ', '') === '' || res['_body'] === '' ) { + return []; + } + res['_body'] = res['_body']; break; } - if ( res['_body'] === '') { - return []; - } - return [{ id: 'html1',