fix: strip invalid as:Endpoints type from Fedify actor serialization
Fedify serializes the endpoints object with "type": "as:Endpoints" which is not a valid ActivityStreams 2.0 type. This causes browser.pub validation failures. Strip the type field in the JSON patching block. Confab-Link: http://localhost:8080/sessions/af5f8b45-6b8d-442d-8f25-78c326190709
This commit is contained in:
@@ -89,6 +89,12 @@ async function sendFedifyResponse(res, response, request) {
|
|||||||
if (json.attachment && !Array.isArray(json.attachment)) {
|
if (json.attachment && !Array.isArray(json.attachment)) {
|
||||||
json.attachment = [json.attachment];
|
json.attachment = [json.attachment];
|
||||||
}
|
}
|
||||||
|
// WORKAROUND: Fedify serializes endpoints with "type": "as:Endpoints"
|
||||||
|
// which is not a valid AS2 type. The endpoints object should be a plain
|
||||||
|
// object with just sharedInbox/proxyUrl etc. Strip the invalid type.
|
||||||
|
if (json.endpoints && json.endpoints.type) {
|
||||||
|
delete json.endpoints.type;
|
||||||
|
}
|
||||||
const patched = JSON.stringify(json);
|
const patched = JSON.stringify(json);
|
||||||
res.setHeader("content-length", Buffer.byteLength(patched));
|
res.setHeader("content-length", Buffer.byteLength(patched));
|
||||||
res.end(patched);
|
res.end(patched);
|
||||||
|
|||||||
Reference in New Issue
Block a user