Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.136.0 (Unreleased)

- Reduce memory usage by only starting the language server (LSP) in projects containing Quarto documents (https://github.com/quarto-dev/quarto/pull/1059)
- Improved the error message shown when inserting a citation from a DOI whose registration agency does not provide citation metadata (<https://github.com/quarto-dev/quarto/pull/1061>).

## 1.135.0 (Release on 2026-07-08)

Expand Down
20 changes: 17 additions & 3 deletions packages/editor-server/src/server/doi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,23 @@ export function doiServer() : DOIServer {
return {
async fetchCSL(doi: string) : Promise<DOIResult> {
const url = `${kDOIHost}/${doi}`;
return handleResponseWithStatus(
() => fetch(url, { headers: { Accept: kCSLJsonFormat } })
);
return handleResponseWithStatus(async () => {
const response = await fetch(url, { headers: { Accept: kCSLJsonFormat } });

// some registration agencies don't support CSL content negotiation;
// for those DOIs the request just redirects to the (HTML) landing
// page, so report that rather than failing to parse the page as JSON
const contentType = response.headers.get("Content-Type") || "";
if (response.ok && !contentType.includes("json")) {
throw new Error(
"This DOI was found, but no citation data is available for it. " +
"This usually means the organization that registered the DOI does not support automatic citation lookup. " +
"To cite this work, you can add an entry to your bibliography manually."
);
}

return response;
});
}
}
}
Expand Down
Loading