diff --git a/news/changelog-1.11.md b/news/changelog-1.11.md index 4944dc36ba8..4ff4453d633 100644 --- a/news/changelog-1.11.md +++ b/news/changelog-1.11.md @@ -73,6 +73,7 @@ All changes included in 1.11: - ([#10756](https://github.com/quarto-dev/quarto-cli/issues/10756)): Fix the notebook preview of an embedded `.qmd` file going missing from the output directory when a project is rendered again, which broke its source notebook link. - ([#14974](https://github.com/quarto-dev/quarto-cli/issues/14974)): Fix math in `.llms.md` files from `llms-txt` coming out garbled with the default `mathjax` method, and with `katex` and `webtex`. Math is now written as `$...$` and `$$...$$` with the `mathjax`, `katex`, `webtex` and `mathml` methods. - ([#15004](https://github.com/quarto-dev/quarto-cli/issues/15004)): Fix notebook preview pages and notebook sources missing from the output directory when a website with embedded notebooks is rendered from a directory other than the project directory. +- ([#15022](https://github.com/quarto-dev/quarto-cli/issues/15022)): Fix rendering a listing with a `feed` failing on Windows with `os error 123` when a listing item's `image` or the feed `image` is a web URL. The image URL is used as is in the feed and no local size lookup is attempted. (author: @Masad791) ## Lua API diff --git a/src/project/types/website/listing/website-listing-feed.ts b/src/project/types/website/listing/website-listing-feed.ts index 53608de9d06..d33e09d59b9 100644 --- a/src/project/types/website/listing/website-listing-feed.ts +++ b/src/project/types/website/listing/website-listing-feed.ts @@ -49,6 +49,7 @@ import { ProjectOutputFile } from "../../types.ts"; import { resolveInputTarget } from "../../../project-index.ts"; import { projectOutputDir } from "../../../project-shared.ts"; import { imageContentType, imageSize } from "../../../../core/image.ts"; +import { isAbsoluteRef } from "../../../../core/http.ts"; import { warnOnce } from "../../../../core/log.ts"; import { isHtmlOutput } from "../../../../config/format.ts"; @@ -174,7 +175,7 @@ export async function createFeed( link: link, url: absoluteUrl(siteUrl, image), }; - const size = imageSize(image); + const size = isAbsoluteRef(image) ? undefined : imageSize(image); if (size) { const [height, width] = feedImageSize(size.height, size.width); feed.image.height = height; @@ -481,16 +482,19 @@ async function renderFeed( } // Image Data - if (item[kFieldImage] && typeof (item[kFieldImage] === "string")) { + if (item[kFieldImage] && typeof item[kFieldImage] === "string") { const image = item[kFieldImage] as string; feedItem.image = absoluteUrl(siteUrl, image); - const imagePath = join(project.dir, image); - feedItem.imageContentType = imageContentType(imagePath); - const size = imageSize(imagePath); - if (size) { - const [height, width] = feedImageSize(size.height, size.width); - feedItem.imageHeight = height; - feedItem.imageWidth = width; + feedItem.imageContentType = imageContentType(image); + // Web images have no local file to read a size from. Joining a URL onto + // the project dir makes an invalid path on Windows and `stat` throws. + if (!isAbsoluteRef(image)) { + const size = imageSize(join(project.dir, image)); + if (size) { + const [height, width] = feedImageSize(size.height, size.width); + feedItem.imageHeight = height; + feedItem.imageWidth = width; + } } } feedItems.push(feedItem); diff --git a/tests/docs/smoke-all/2026/10/12/issue-15022/.gitignore b/tests/docs/smoke-all/2026/10/12/issue-15022/.gitignore new file mode 100644 index 00000000000..43c566bbdf3 --- /dev/null +++ b/tests/docs/smoke-all/2026/10/12/issue-15022/.gitignore @@ -0,0 +1,3 @@ +/.quarto/ +_site/ +**/*.quarto_ipynb diff --git a/tests/docs/smoke-all/2026/10/12/issue-15022/_quarto.yml b/tests/docs/smoke-all/2026/10/12/issue-15022/_quarto.yml new file mode 100644 index 00000000000..18e309ed964 --- /dev/null +++ b/tests/docs/smoke-all/2026/10/12/issue-15022/_quarto.yml @@ -0,0 +1,6 @@ +project: + type: website + +website: + title: "issue-15022" + site-url: https://example.com diff --git a/tests/docs/smoke-all/2026/10/12/issue-15022/index.qmd b/tests/docs/smoke-all/2026/10/12/issue-15022/index.qmd new file mode 100644 index 00000000000..e18f81baee7 --- /dev/null +++ b/tests/docs/smoke-all/2026/10/12/issue-15022/index.qmd @@ -0,0 +1,16 @@ +--- +title: "issue-15022" +listing: + contents: posts + feed: + image: https://example.com/feed-image.png +_quarto: + render-project: true + tests: + html: + fileExists: + outputPath: index.xml +--- + +A listing feed whose items and feed image are web URLs must render without +trying to read them from the project directory. diff --git a/tests/docs/smoke-all/2026/10/12/issue-15022/posts/remote-image/index.qmd b/tests/docs/smoke-all/2026/10/12/issue-15022/posts/remote-image/index.qmd new file mode 100644 index 00000000000..126445bc4ff --- /dev/null +++ b/tests/docs/smoke-all/2026/10/12/issue-15022/posts/remote-image/index.qmd @@ -0,0 +1,7 @@ +--- +title: "Post with a remote image" +date: "2026-10-12" +image: https://example.com/remote-thumbnail.png +--- + +This post uses a web-hosted image as its listing thumbnail.