mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
refactor(api): 🎨 Switch to base64url for proxy url encoding instead of plaintext
This commit is contained in:
parent
3be9d1d6ce
commit
5f785c391d
2 changed files with 14 additions and 3 deletions
|
|
@ -73,9 +73,10 @@ export const redirect = (url: string | URL, status = 302) => {
|
|||
};
|
||||
|
||||
export const proxyUrl = (url: string | null) => {
|
||||
const urlAsBase64Url = Buffer.from(url || "").toString("base64url");
|
||||
return url
|
||||
? new URL(
|
||||
`/media/proxy?url=${encodeURIComponent(url)}`,
|
||||
`/media/proxy?url=${urlAsBase64Url}`,
|
||||
config.http.base_url,
|
||||
).toString()
|
||||
: url;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue