fix CVE-2022-39299 (bump xmldom) (#820)

This commit is contained in:
slothful-vassal
2026-02-18 21:53:41 +01:00
committed by GitHub
parent 01d85b32f3
commit 5595f9b4d3
3 changed files with 15 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ import EasyFit from "$lib/vendor/easy-fit/easy-fit";
import type { Feature, FeatureCollection, GeoJSON, GeoJsonProperties, Position } from 'geojson';
import JSZip from "jszip";
import type { AuthRecord } from "pocketbase";
import * as xmldom from 'xmldom';
import { DOMParser as XMLDOMParser } from "@xmldom/xmldom";
import { bbox, splitMultiLineStringToLineStrings } from "./geojson_util";
import { trails_show } from "$lib/stores/trail_store";
import { handleFromRecordWithIRI } from "./activitypub_util";
@@ -161,7 +161,7 @@ export async function fromFile(file: File | Blob) {
}
export function fromKML(kmlData: string) {
const parser = browser ? new DOMParser() : new xmldom.DOMParser();
const parser = browser ? new DOMParser() : new XMLDOMParser();
const nodes = parser.parseFromString(kmlData, "text/xml")
const geojson = kml(nodes) as Feature | FeatureCollection
@@ -178,7 +178,7 @@ export async function fromKMZ(kmzData: ArrayBuffer) {
}
export function fromTCX(tcxData: string) {
const parser = browser ? new DOMParser() : new xmldom.DOMParser();
const parser = browser ? new DOMParser() : new XMLDOMParser();
const nodes = parser.parseFromString(tcxData, "text/xml")
const geojson = tcx(nodes) as Feature | FeatureCollection
@@ -394,4 +394,4 @@ export function cropGPX(start: GPXWaypoint, end: GPXWaypoint, gpx: GPX): GPX {
}).filter(track => track.trkseg.length > 0);
return new GPX({ ...gpx, trk: croppedTrk?.map(t => new Track({ ...t })) ?? [], })
}
}