Skip to content

Fix UnicodeDecodeError on Windows when upload fails#123

Open
AHReccese wants to merge 3 commits intodevfrom
fix/encoding_error
Open

Fix UnicodeDecodeError on Windows when upload fails#123
AHReccese wants to merge 3 commits intodevfrom
fix/encoding_error

Conversation

@AHReccese
Copy link
Member

@AHReccese AHReccese commented Mar 3, 2026

Reference Issues/PRs

#122 +
Replace shields.io GitHub stars badge with badgen.net due to frequent recent shields.io service issues

What does this implement/fix? Explain your changes.

Any other comments?

@AHReccese AHReccese added this to the reserver v0.7 milestone Mar 3, 2026
@AHReccese AHReccese self-assigned this Mar 3, 2026
@AHReccese AHReccese added the bug Something isn't working label Mar 3, 2026
@AHReccese AHReccese requested a review from sepandhaghighi March 3, 2026 23:23
@AHReccese AHReccese requested review from sadrasabouri and removed request for sepandhaghighi March 4, 2026 17:29
@AHReccese
Copy link
Member Author

@sadrasabouri
Hi Sadra, after a quick double-check with Sepand today, I confirmed that this PR is also assigned to you.

Copy link
Member

@sadrasabouri sadrasabouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The badges look good but I don't have Windows to verify the other part. Can you add a test that reproduce the case?
I left some minor comments to.

error = error.decode('utf-8')
if error is None:
error = "Unknown error (no output captured)"
elif isinstance(error, bytes):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if error==''

Comment on lines +133 to +139
if encoding:
try:
error = error.decode(encoding)
except (UnicodeDecodeError, LookupError):
error = error.decode('utf-8', errors='replace')
else:
error = error.decode('utf-8', errors='replace')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we simplify if by bringing back try/except one indent and adding the error due to encoding being None to the list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants