mirror of
https://github.com/svemagie/indiekit-endpoint-activitypub.git
synced 2026-04-02 15:44:58 +02:00
fix: profile links lost on save due to qs body parser key mismatch
express.urlencoded({ extended: true }) uses qs which strips [] from
field names, so link_name[] arrives as request.body.link_name — not
request.body["link_name[]"]. The old lookup always got undefined,
producing an empty attachments array that overwrote existing links.
This commit is contained in:
@@ -50,9 +50,15 @@ export function profilePostController(mountPath, plugin) {
|
||||
authorizedFetch,
|
||||
} = request.body;
|
||||
|
||||
// Parse profile links (attachments) from form arrays
|
||||
const linkNames = [].concat(request.body["link_name[]"] || []);
|
||||
const linkValues = [].concat(request.body["link_value[]"] || []);
|
||||
// Parse profile links (attachments) from form arrays.
|
||||
// With express.urlencoded({ extended: true }), qs strips the []
|
||||
// suffix so the data arrives as request.body.link_name (array).
|
||||
const linkNames = [].concat(
|
||||
request.body.link_name || request.body["link_name[]"] || [],
|
||||
);
|
||||
const linkValues = [].concat(
|
||||
request.body.link_value || request.body["link_value[]"] || [],
|
||||
);
|
||||
const attachments = [];
|
||||
for (let i = 0; i < linkNames.length; i++) {
|
||||
const n = linkNames[i]?.trim();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rmdes/indiekit-endpoint-activitypub",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8",
|
||||
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
|
||||
"keywords": [
|
||||
"indiekit",
|
||||
|
||||
Reference in New Issue
Block a user