tools: follow_redirects=False causes silent wrong file contents

Open Beginner friendly
#26 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
backend

Research direction

Start in src/entrabot/tools/files.py at _client and the content-handling blocks around L625-L650. Review the existing respx tests, then add coverage for a 302 redirect to a second mocked URL. Done means redirected file content is read correctly and the misleading comment is removed.

Written by the indexing model from the issue text.

Description

bug

File: src/entrabot/tools/files.py
Location: L289, L625-L629, L637-L640, L647-L650
Category: bug
Priority: high

Description

_client() builds httpx.AsyncClient without follow_redirects=True. httpx default is False. Graph /content returns 302 to a pre-signed URL; for raw text reads the code accepts status 302 and decodes the empty redirect body as the file contents, silently returning wrong data. PDF/docx paths only accept 200, so 302 becomes a spurious error. The in-line comment "httpx auto-follows redirects" is wrong. The project's own platform-learnings doc explicitly mandates follow_redirects=True. Tests miss this because they all mock 200 directly.

Suggested fix

Pass follow_redirects=True to httpx.AsyncClient in _client (or per-request on /content GETs). Remove the misleading comment. Add a respx test that returns 302 with a Location to a second mocked URL.


Filed automatically by a thorough code-review pass over src/entrabot/ on 2026-06-13. Internal review id: #16.

Dominant language
Python
Stars
9
Forks
6
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/entrabot

All issues in microsoft/entrabot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.