@rmdes/indiekit-endpoint-rss 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/lib/rss-client.js +13 -4
  2. package/package.json +1 -1
package/lib/rss-client.js CHANGED
@@ -326,14 +326,23 @@ export class RssClient {
326
326
  * @returns {string|null}
327
327
  */
328
328
  extractFeedImage(parsed) {
329
+ // Helper to get first string from value (handles arrays)
330
+ const getString = (val) => {
331
+ if (!val) return null;
332
+ if (Array.isArray(val)) return val[0] || null;
333
+ if (typeof val === "object" && val.url) return val.url;
334
+ return typeof val === "string" ? val : null;
335
+ };
336
+
329
337
  // RSS 2.0 image
330
- if (parsed.image?.url) return parsed.image.url;
338
+ if (parsed.image?.url) return getString(parsed.image.url);
339
+ if (parsed.image) return getString(parsed.image);
331
340
  // Atom icon
332
- if (parsed.icon) return parsed.icon;
341
+ if (parsed.icon) return getString(parsed.icon);
333
342
  // Atom logo
334
- if (parsed.logo) return parsed.logo;
343
+ if (parsed.logo) return getString(parsed.logo);
335
344
  // itunes:image
336
- if (parsed.itunes?.image) return parsed.itunes.image;
345
+ if (parsed.itunes?.image) return getString(parsed.itunes.image);
337
346
  return null;
338
347
  }
339
348
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-rss",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "RSS feed reader endpoint for Indiekit. Aggregates multiple feeds, caches in MongoDB, displays on frontend.",
5
5
  "keywords": [
6
6
  "indiekit",