Skip to content

Commit 86cde7b

Browse files
authored
Catch ValueErrors thrown when attempting to remove a file twice (#3314)
1 parent 0d9e341 commit 86cde7b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

mkdocs/structure/files.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,15 @@ def get_files(config: MkDocsConfig) -> Files:
367367
log.warning(
368368
f"Excluding '{a.src_uri}' from the site because it conflicts with '{b.src_uri}'."
369369
)
370-
files.remove(a)
370+
try:
371+
files.remove(a)
372+
except ValueError:
373+
pass # Catching this to avoid errors if attempting to remove the same file twice.
371374
else:
372-
files.remove(b)
375+
try:
376+
files.remove(b)
377+
except ValueError:
378+
pass
373379

374380
return Files(files)
375381

0 commit comments

Comments
 (0)