fix(builds): handle files without extension in artifact processing#12921
Open
Bahtya wants to merge 1 commit intoreadthedocs:mainfrom
Open
fix(builds): handle files without extension in artifact processing#12921Bahtya wants to merge 1 commit intoreadthedocs:mainfrom
Bahtya wants to merge 1 commit intoreadthedocs:mainfrom
Conversation
When a build output file has no filename extension, rsplit(".") returns
only one element, causing a ValueError when trying to unpack into two
variables. This crashes the entire build.
Add a check for "." in the filename and skip files without extensions
with a warning log instead of crashing.
Fixes readthedocs#12917
Signed-off-by: bahtya <bahtyar153@qq.com>
agjohnson
reviewed
Apr 8, 2026
| "Skipping artifact file without extension: %s", | ||
| filename, | ||
| ) | ||
| continue |
Contributor
There was a problem hiding this comment.
It would probably be best to move away from string operations entirely. Pathlib already handles these filename operations -- ie:
Path(list_dir[0]).suffixThere isn't a strong case to skip the file, we just need to be careful about not throwing an exception parsing the file.
Member
There was a problem hiding this comment.
Would be good to get this in today for deploy -- @Bahtya if you have time could you push up the proposed fix, otherwise we should probably just apply the fix to the PR and merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a build output file has no filename extension, the build crashes with:
This happens because
rsplit(".")returns only one element when there is no.in the filename.Fix
Check for
.in the filename before callingrsplit. If the file has no extension, log a warning and skip it instead of crashing the build.Fixes #12917