import { Feed } from "feed";
const imageUrl = "https://example.com/328314f6-4317-4579-990c-b2047d1804ef/public";
const feed = new Feed({
title: "Test Feed",
id: "https://example.com/",
link: "https://example.com/",
image: imageUrl,
});
// Add an item with an explicit image type (expected to be respected across formats)
feed.addItem({
title: "Post 1",
id: "https://example.com/posts/1",
link: "https://example.com/posts/1",
image: imageUrl,
// Depending on API surface, explicit MIME type may be attached via attachments or extensions, e.g.:
// attachments: [{ url: imageUrl, mimeType: "image/jpeg" }]
});
const rss = feed.rss2(); // OK
const atom = feed.atom1(); // BUG: type mangled, e.g., "image//328314f6-4317-4579-990c-b2047d1804ef/public"
const json = feed.json1(); // BUG: type mangled
console.log({ rss, atom, json });
Describe the bug
When generating Atom and JSON feeds with the
feedlibrary, the image MIME type is incorrectly inferred from the image URL even when an explicit type is provided. This results in malformed type strings such asimage//328314f6-4317-4579-990c-b2047d1804ef/publicwhen the URL includes segments like/public. RSS output appears to respect the provided type and does not exhibit this issue.To Reproduce
Feedinstance with an image and/or add an item with an image, supplying an explicit MIME type (e.g.,image/jpeg).atom1()) and JSON (json1()) outputs.image//328314f6-4317-4579-990c-b2047d1804ef/public, while RSS (rss2()) behaves correctly.Minimal example:
Expected behavior
image/jpeg,image/png), use it as-is across RSS, Atom, and JSON.Actual behavior
image//328314f6-4317-4579-990c-b2047d1804ef/public.Additional context