Skip to content

Fix: add safe decode_file fallback for “encoding: none” and refactor callers to use it. - #820

Merged
haesleinhuepf merged 2 commits into
mainfrom
git-bob-mod-CLkZZE3wAH
Aug 20, 2025
Merged

Fix: add safe decode_file fallback for “encoding: none” and refactor callers to use it.#820
haesleinhuepf merged 2 commits into
mainfrom
git-bob-mod-CLkZZE3wAH

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

This message was generated by git-bob (version: 0.27.0, model: openai:gpt-5-2025-08-07, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

This PR fixes Issue #819 by handling GitHub’s “encoding: none” responses that caused PyGithub’s decoded_content assertion to fail. I added a robust decode_file() that first tries the standard path and, on assertion failure, falls back to downloading via download_url or the Git blob API, preserving the existing behavior of raising UnicodeDecodeError for binary content. I then refactored internal callers to use decode_file() instead of directly accessing decoded_content.decode() in get_repository_file_contents, rename_file_in_repository, and copy_file_in_repository.

closes #819

github-actions Bot and others added 2 commits August 20, 2025 16:53
…ed all internal uses of .decoded_content.decode() to call decode_file instead.
@codecov

codecov Bot commented Aug 20, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 12.50000% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.08%. Comparing base (186eff5) to head (cd65780).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/git_bob/_github_utilities.py 12.50% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #820      +/-   ##
==========================================
- Coverage   58.58%   58.08%   -0.51%     
==========================================
  Files          14       14              
  Lines        1910     1930      +20     
==========================================
+ Hits         1119     1121       +2     
- Misses        791      809      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@haesleinhuepf
haesleinhuepf merged commit 1176e43 into main Aug 20, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error

1 participant