[backend] Don't proxy relative URLs

This fixes the instance icon for the local instance not being rendered correctly. Resolves #426
This commit is contained in:
Laura Hausmann 2023-12-04 13:34:36 +01:00
parent 1c06b84011
commit 4a90408386
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605

View File

@ -90,6 +90,7 @@ export const DriveFileRepository = db.getRepository(DriveFile).extend({
getFinalUrl(url: string): string { getFinalUrl(url: string): string {
if (!config.proxyRemoteFiles) return url; if (!config.proxyRemoteFiles) return url;
if (!url.startsWith('https://') && !url.startsWith('http://')) return url;
if (url.startsWith(`${config.url}/files`)) return url; if (url.startsWith(`${config.url}/files`)) return url;
if (url.startsWith(`${config.url}/static-assets`)) return url; if (url.startsWith(`${config.url}/static-assets`)) return url;
if (url.startsWith(`${config.url}/identicon`)) return url; if (url.startsWith(`${config.url}/identicon`)) return url;