1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-21 15:47:29 +00:00

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

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) {