Fix attribution download for .jpg

This commit is contained in:
Pieter Vander Vennet 2024-03-07 11:47:20 +01:00
parent 68e63f8e39
commit 3afbb8b6fe

View file

@ -9,7 +9,7 @@ export default class ImgurAttribution {
* Download the attribution from a given URL
*/
public static async DownloadAttribution(url: string): Promise<{license: string, author: string}> {
const hash = url.substr("https://i.imgur.com/".length).split(".jpg")[0]
const hash = url.substr("https://i.imgur.com/".length).split(/.jpe?g/i)[0]
const apiUrl = "https://api.imgur.com/3/image/" + hash
const response = await Utils.DownloadJson(apiUrl, {