Skip to content
Merged
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
4 changes: 4 additions & 0 deletions news/changelog-1.8.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
All changes included in 1.8:

## Projects

### `website`

- ([#12551](https://github.com/quarto-dev/quarto-cli/pull/12551)): Improve warning issued when `aliases` would overwrite an existing document.
15 changes: 11 additions & 4 deletions src/project/types/website/website-aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,17 @@ export async function updateAliases(

// Write the redirect file
if (allOutputFiles.find((outputFile) => outputFile === targetFile)) {
// Do not, this is the same name as an output file!
warning(
`Aliases that you have created would overwrite the output file ${targetFile}. The aliases file was not created.`,
);
for (
const offendingAlias of targetHrefs.filter(
(targetHref) =>
targetHref.href ===
relative(dirname(targetHref.outputFile), targetFile),
)
) {
warning(
`Requested alias ${targetFile} -> ${offendingAlias.outputFile} would overwrite the target. Skipping.`,
);
}
} else {
// Write, this is a safe file
writeMultipleRedirectPage(targetFile, redirects);
Expand Down
Loading