From 17f097851aafeb4db9c8cc0590abde9efe8bf599 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sat, 23 Aug 2025 13:36:42 +0200 Subject: [PATCH] Fix: panoramax attribution now filters out empty strings (for some edge cases on non-mapcomplete panoramax servers) --- src/Logic/ImageProviders/Panoramax.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Logic/ImageProviders/Panoramax.ts b/src/Logic/ImageProviders/Panoramax.ts index a1bea5f5a..362a4ab25 100644 --- a/src/Logic/ImageProviders/Panoramax.ts +++ b/src/Logic/ImageProviders/Panoramax.ts @@ -11,6 +11,9 @@ import { Feature, Point } from "geojson" import { AddImageOptions } from "panoramax-js/dist/Panoramax" import { ServerSourceInfo } from "../../Models/SourceOverview" import { ComponentType } from "svelte/types/runtime/internal/dev" +import { Strings } from "../../Utils/Strings" +import { Utils } from "../../Utils" +import { Lists } from "../../Utils/Lists" export default class PanoramaxImageProvider extends ImageProvider { public static readonly singleton: PanoramaxImageProvider = new PanoramaxImageProvider() @@ -194,9 +197,13 @@ export default class PanoramaxImageProvider extends ImageProvider { public async DownloadAttribution(providedImage: { id: string }): Promise { const meta = await this.getInfoFor(providedImage.id) + const artists = Lists.noEmpty(meta.data.providers.map(p => p.name)) + + // We take the last provider, as that one probably contain the username of the uploader + const artist = artists.at(-1) return { - artist: meta.data.providers.at(-1).name, // We take the last provider, as that one probably contain the username of the uploader + artist, date: new Date(meta.data.properties["datetime"]), licenseShortName: meta.data.properties["geovisio:license"], }