@datagouv/components-next 1.0.2-dev.202 → 1.0.2-dev.204
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.
- package/dist/{Datafair.client-CCziAlBg.js → Datafair.client-Cvuga2fe.js} +1 -1
- package/dist/{ImagePreview.client-CAvNUnVD.js → ImagePreview.client-BXpk0FV-.js} +1 -1
- package/dist/{JsonPreview.client-BHZx8aen.js → JsonPreview.client-D8dODX5U.js} +2 -2
- package/dist/{MapContainer.client-CbfoAPCF.js → MapContainer.client-BJVvyB2o.js} +2 -2
- package/dist/{PdfPreview.client-BWq1dMvs.js → PdfPreview.client-DGy-H39T.js} +2 -2
- package/dist/{Pmtiles.client-Diw2dwhY.js → Pmtiles.client-4prB0MP3.js} +127 -127
- package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-3CDNhxIL.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-BoORZnnB.js} +1 -1
- package/dist/{XmlPreview.client-HUxB9uqG.js → XmlPreview.client-DZnb0Kgw.js} +3 -3
- package/dist/components-next.js +84 -83
- package/dist/{index-BTx5DUIG.js → index-EN--nWTY.js} +1 -1
- package/dist/{leaflet-src-DNSrX3rh.js → leaflet-src-RBL-h8nt.js} +1 -1
- package/dist/{main--ZN-jusz.js → main-CICNrWF8.js} +6154 -6146
- package/dist/{vue3-xml-viewer.common-UMibNgKb.js → vue3-xml-viewer.common-BzKiHzXQ.js} +1 -1
- package/package.json +1 -1
- package/src/components/ResourceAccordion/Pmtiles.client.vue +2 -6
- package/src/functions/owned.ts +21 -0
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ import styleVector from '../../../assets/json/vector.json'
|
|
|
67
67
|
import PreviewUnavailable from './PreviewUnavailable.vue'
|
|
68
68
|
import { useTranslation } from '../../composables/useTranslation'
|
|
69
69
|
import franceSvg from './france.svg?raw'
|
|
70
|
-
import {
|
|
70
|
+
import { getMapAttribution } from '../../functions/owned'
|
|
71
71
|
|
|
72
72
|
const props = defineProps<{ resource: Resource, dataset: Dataset | DatasetV2 }>()
|
|
73
73
|
|
|
@@ -94,11 +94,7 @@ const lastUpdate = computed(() => {
|
|
|
94
94
|
|
|
95
95
|
const container = useTemplateRef('containerRef')
|
|
96
96
|
|
|
97
|
-
const attributions = computed(() =>
|
|
98
|
-
if (!props.dataset.organization && !props.dataset.owner)
|
|
99
|
-
return ''
|
|
100
|
-
return `© <a href="${getOwnerPage(props.dataset)}" target="_blank">${getOwnerName(props.dataset)}</a>`
|
|
101
|
-
})
|
|
97
|
+
const attributions = computed(() => getMapAttribution(props.dataset))
|
|
102
98
|
|
|
103
99
|
async function displayMap() {
|
|
104
100
|
await import('maplibre-gl/dist/maplibre-gl.css')
|
package/src/functions/owned.ts
CHANGED
|
@@ -19,3 +19,24 @@ export function getOwnerPage(owned: Owned): string | null {
|
|
|
19
19
|
}
|
|
20
20
|
return null // Not supposed to exist but it does...
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
function escapeHtml(value: string): string {
|
|
24
|
+
return value
|
|
25
|
+
.replace(/&/g, '&')
|
|
26
|
+
.replace(/</g, '<')
|
|
27
|
+
.replace(/>/g, '>')
|
|
28
|
+
.replace(/"/g, '"')
|
|
29
|
+
.replace(/'/g, ''')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getMapAttribution(owned: Owned): string {
|
|
33
|
+
const name = getOwnerName(owned)
|
|
34
|
+
const page = getOwnerPage(owned)
|
|
35
|
+
if (!name && !page)
|
|
36
|
+
return ''
|
|
37
|
+
// The owner name is free text any user controls (organization name, or a
|
|
38
|
+
// profile's first/last name). maplibre-gl injects this attribution string
|
|
39
|
+
// into the DOM as HTML, and its own attribution sanitizer is bypassable via
|
|
40
|
+
// mutation XSS, so every interpolated value has to be escaped here.
|
|
41
|
+
return `© <a href="${escapeHtml(page ?? '')}" target="_blank">${escapeHtml(name)}</a>`
|
|
42
|
+
}
|