summary refs log tree commit diff
path: root/src/cdn
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-07-06 11:08:51 +0200
committerRory& <root@rory.gay>2025-07-06 18:03:17 +0200
commitb590482bfbed461c47e785e1bf59d16e211c6982 (patch)
tree12543ce35030da7a51596a3e5a2fe2a78f57ecb9 /src/cdn
parentResolve eslint errors (diff)
downloadserver-ts-b590482bfbed461c47e785e1bf59d16e211c6982.tar.xz
Prettier
Diffstat (limited to 'src/cdn')
-rw-r--r--src/cdn/routes/attachments.ts25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/cdn/routes/attachments.ts b/src/cdn/routes/attachments.ts

index 4447edeb0..4dca803b8 100644 --- a/src/cdn/routes/attachments.ts +++ b/src/cdn/routes/attachments.ts
@@ -18,8 +18,10 @@ import { Config, - hasValidSignature, NewUrlUserSignatureData, - Snowflake, UrlSignResult, + hasValidSignature, + NewUrlUserSignatureData, + Snowflake, + UrlSignResult, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import FileType from "file-type"; @@ -93,16 +95,21 @@ router.get( const path = `attachments/${channel_id}/${id}/${filename}`; - const fullUrl = (req.headers["x-forwarded-proto"] ?? req.protocol) + "://" - + (req.headers["x-forwarded-host"] ?? req.hostname) - + req.originalUrl; + const fullUrl = + (req.headers["x-forwarded-proto"] ?? req.protocol) + + "://" + + (req.headers["x-forwarded-host"] ?? req.hostname) + + req.originalUrl; if ( Config.get().security.cdnSignUrls && - !hasValidSignature(new NewUrlUserSignatureData({ - ip: req.ip, - userAgent: req.headers["user-agent"] as string, - }), UrlSignResult.fromUrl(fullUrl)) + !hasValidSignature( + new NewUrlUserSignatureData({ + ip: req.ip, + userAgent: req.headers["user-agent"] as string, + }), + UrlSignResult.fromUrl(fullUrl), + ) ) { return res.status(404).send("This content is no longer available."); }