Geomap: Only prefix with grafana public path if relative url (#111081) (#111106)

only prefix with grafana public path if relative url
This commit is contained in:
Ashley Harrison
2025-09-15 15:42:47 +01:00
committed by GitHub
parent 59cc00b07e
commit c68d3a2ffa
@@ -78,9 +78,11 @@ export const geojsonLayer: MapLayerRegistryItem<GeoJSONMapperConfig> = {
// Interpolate variables in the URL
const interpolatedUrl = getTemplateSrv().replace(config.src || '');
const isAbsoluteUrl = interpolatedUrl.startsWith('http');
const layerUrl = isAbsoluteUrl ? interpolatedUrl : `${window.__grafana_public_path__}${interpolatedUrl.replace(/^(public\/)/, '')}`;
const source = new VectorSource({
url: `${window.__grafana_public_path__}build/${interpolatedUrl.replace(/^(public\/)/, '')}`,
url: layerUrl,
format: new GeoJSON(),
});