@rmdes/indiekit-endpoint-micropub 1.0.0-beta.31 → 1.0.0-beta.32

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.
package/lib/config.js CHANGED
@@ -19,12 +19,22 @@ export const getConfig = (application, publication) => {
19
19
  "syndicate-to",
20
20
  ];
21
21
 
22
- // Ensure syndication targets use absolute URLs
23
- const syndicateTo = syndicationTargets.map((target) => target.info);
24
- for (const info of syndicateTo) {
25
- if (info.service && info.service.photo) {
22
+ // Ensure syndication targets use absolute URLs. A misconfigured syndicator
23
+ // whose `info` getter throws (e.g. `new URL("")` on an empty instance URL)
24
+ // must not crash the Micropub config query — omit it from the advertised
25
+ // targets instead of letting it take down `q=config`.
26
+ const syndicateTo = [];
27
+ for (const target of syndicationTargets) {
28
+ let info;
29
+ try {
30
+ info = target.info;
31
+ } catch {
32
+ continue;
33
+ }
34
+ if (info?.service?.photo) {
26
35
  info.service.photo = new URL(info.service.photo, url).href;
27
36
  }
37
+ syndicateTo.push(info);
28
38
  }
29
39
 
30
40
  return {
package/lib/jf2.js CHANGED
@@ -304,7 +304,14 @@ export const getSyndicateToProperty = (properties, syndicationTargets) => {
304
304
  }
305
305
 
306
306
  for (const target of syndicationTargets) {
307
- const { uid } = target.info;
307
+ // A misconfigured syndicator whose `info` getter throws must not crash
308
+ // post creation; skip it when resolving mp-syndicate-to.
309
+ let uid;
310
+ try {
311
+ uid = target.info.uid;
312
+ } catch {
313
+ continue;
314
+ }
308
315
  const syndicateTo = properties["mp-syndicate-to"];
309
316
 
310
317
  if (syndicateTo?.includes(uid)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-micropub",
3
- "version": "1.0.0-beta.31",
3
+ "version": "1.0.0-beta.32",
4
4
  "description": "Micropub endpoint for Indiekit with custom type-based post discovery. Enables publishing content to your website using the Micropub protocol.",
5
5
  "keywords": [
6
6
  "indiekit",