forked from MapComplete/MapComplete
Fix: panoramax attribution now filters out empty strings (for some edge cases on non-mapcomplete panoramax servers)
This commit is contained in:
parent
5b7a117af3
commit
17f097851a
1 changed files with 8 additions and 1 deletions
|
@ -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<LicenseInfo> {
|
||||
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"],
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue