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

only prefix with grafana public path if relative url
This commit is contained in:
Ashley Harrison
2025-09-15 15:09:35 +01:00
committed by GitHub
parent a5bd313f5a
commit 04ca5d9ffd
@@ -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(),
});