Fix mapillary image detection

This commit is contained in:
Pieter Vander Vennet 2021-10-18 22:17:41 +02:00
parent 46e3fa84de
commit 83f79d95b9
3 changed files with 7 additions and 9 deletions

View file

@ -15,14 +15,11 @@ export class Mapillary extends ImageProvider {
private static readonly valuePrefix = "https://a.mapillary.com"
public static readonly valuePrefixes = [Mapillary.valuePrefix, "http://mapillary.com","https://mapillary.com"]
private constructor() {
super();
}
private static ExtractKeyFromURL(value: string, failIfNoMath = false): {
key: string,
isApiv4?: boolean
} {
if (value.startsWith(Mapillary.valuePrefix)) {
const key = value.substring(0, value.lastIndexOf("?")).substring(value.lastIndexOf("/") + 1)
return {key: key, isApiv4: !isNaN(Number(key))};
@ -61,7 +58,7 @@ export class Mapillary extends ImageProvider {
}
async ExtractUrls(key: string, value: string): Promise<Promise<ProvidedImage>[]> {
return [this.PrepareUrlAsync(key, value)]
return [this.PrepareUrlAsync(key, value)]
}
private async PrepareUrlAsync(key: string, value: string): Promise<ProvidedImage> {