Allow viewing webp files

This commit is contained in:
Cadence Ember 2022-02-18 12:04:00 +13:00
parent 3700b3a9ac
commit 09b33ef3fa
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
1 changed files with 1 additions and 1 deletions

View File

@ -52,7 +52,7 @@ module.exports = [
route: "/imageproxy", methods: ["GET"], code: async (input) => {
const verifyResult = verifyURL(input.url)
if (verifyResult.status !== "ok") return verifyResult.value
if (!["png", "jpg"].some(ext => verifyResult.url.pathname.endsWith(ext))) return [400, "URL extension is not allowed"]
if (!["png", "jpg", "webp"].some(ext => verifyResult.url.pathname.endsWith(ext))) return [400, "URL extension is not allowed"]
const params = input.url.searchParams
const width = +params.get("width")
if (typeof width === "number" && !isNaN(width) && width > 0) {