Federated URL backend handling

This commit is contained in:
Zef Hemel
2023-07-29 17:06:32 +02:00
parent 7442aac7e0
commit 21c8cd6e7a
3 changed files with 22 additions and 1 deletions
+11
View File
@@ -344,6 +344,17 @@ export class HttpServer {
response.body = "Not exposed";
return;
}
// Handle federated links through a simple redirect, only used for attachments loads with service workers disabled
if (name.startsWith("!")) {
let url = name.slice(1);
if (url.startsWith("localhost")) {
url = `http://${url}`;
} else {
url = `https://${url}`;
}
response.redirect(url);
return;
}
try {
const fileData = await spacePrimitives.readFile(
name,