Scripts: support .png-uploads in imgur-to-panoramax script

This commit is contained in:
Pieter Vander Vennet 2024-11-17 22:56:10 +01:00
parent 3c90d33b9d
commit a0feed3695
2 changed files with 14 additions and 7 deletions

View file

@ -95,7 +95,7 @@ export class Imgur extends ImageProvider {
withResponse?: (obj) => void
): Promise<LicenseInfo> {
const url = providedImage.url
const hash = url.substr("https://i.imgur.com/".length).split(/\.jpe?g/i)[0]
const hash = url.substr("https://i.imgur.com/".length).split(/(\.jpe?g)|(\.png)/i)[0]
const apiUrl = "https://api.imgur.com/3/image/" + hash
const response = await Utils.downloadJsonCached<{