@rmdes/indiekit-endpoint-activitypub 3.11.1 → 3.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,9 +67,18 @@ export function createMastodonRouter({ collections, pluginOptions = {} }) {
67
67
 
68
68
  // ─── Body parsers ───────────────────────────────────────────────────────
69
69
  // Mastodon clients send JSON, form-urlencoded, and occasionally text/plain.
70
- // These must be applied before route handlers.
71
- router.use("/api", express.json());
72
- router.use("/api", express.urlencoded({ extended: true }));
70
+ // Skip multipart/form-data requests multer handles those in media routes.
71
+ // If express.json/urlencoded consume the stream first, multer gets nothing.
72
+ const jsonParser = express.json();
73
+ const urlencodedParser = express.urlencoded({ extended: true });
74
+ router.use("/api", (req, res, next) => {
75
+ if (req.is("multipart/form-data")) return next();
76
+ jsonParser(req, res, next);
77
+ });
78
+ router.use("/api", (req, res, next) => {
79
+ if (req.is("multipart/form-data")) return next();
80
+ urlencodedParser(req, res, next);
81
+ });
73
82
  router.use("/oauth", express.json());
74
83
  router.use("/oauth", express.urlencoded({ extended: true }));
75
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "3.11.1",
3
+ "version": "3.11.2",
4
4
  "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
5
5
  "keywords": [
6
6
  "indiekit",