From c5d64c182b268ba3571b1a64b402a80d5d0bb46a Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 1 Jun 2025 14:11:14 +0300 Subject: [PATCH] fix(geomap): not rendering on desktop (closes #2085) --- apps/client/src/widgets/type_widgets/geo_map.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/type_widgets/geo_map.ts b/apps/client/src/widgets/type_widgets/geo_map.ts index 320fb7c9a..bf7433572 100644 --- a/apps/client/src/widgets/type_widgets/geo_map.ts +++ b/apps/client/src/widgets/type_widgets/geo_map.ts @@ -224,9 +224,14 @@ export default class GeoMapTypeWidget extends TypeWidget { this.gpxLoaded = true; } - // TODO: This is not very efficient as it's probably a string response that is parsed and then converted back to string and parsed again. - const xmlResponse = await server.get(`notes/${note.noteId}/open`); - const stringResponse = new XMLSerializer().serializeToString(xmlResponse); + const xmlResponse = await server.get(`notes/${note.noteId}/open`); + let stringResponse: string; + if (xmlResponse instanceof Uint8Array) { + stringResponse = new TextDecoder().decode(xmlResponse); + } else { + // TODO: This is not very efficient as it's probably a string response that is parsed and then converted back to string and parsed again. + stringResponse = new XMLSerializer().serializeToString(xmlResponse) + } const track = new this.L.GPX(stringResponse, {}); track.addTo(this.geoMapWidget.map);