Fix 'api/' endpoint auto-fix of file transfers - #360
Closed
BigRoy wants to merge 1 commit into
Closed
Conversation
- Web frontend answers unknown urls (without 'api/') with 'index.html' and status 200, so the 404 based auto-fix never happened and download saved the html page as the file. - The auto-fix consumed a retry attempt. With 'max_retries' 1 the transfer ended without sending the fixed request. - Upload progress was not reset when content was sent again to fixed url, so transferred size was doubled. - Download stored fixed url as destination url instead of source url. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
BigRoy
added this pull request to stack #362
September 12, 2026 22:18
iLLiCiTiT
reviewed
Sep 14, 2026
| # for unknown urls, which is not a file to download. | ||
| is_frontend_page = ( | ||
| response.ok | ||
| and "text/html" in response.headers.get( |
Member
There was a problem hiding this comment.
For me the question is if this is wrong? It has been changed so long ago that anyone using it without the api/ probably already did fix it. I would rather remove the backwards compatibility instead of adding more checks.
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.
Bug
Transfers try to auto-fix endpoints missing the
api/prefix (projects/...→api/projects/...), but:200andindex.html, so the404/405check never triggered.download_file("projects/<p>/thumbnails/<id>", path)writes<!DOCTYPE html>...instead of the image, without any error.max_retries=1the loop ended right after deciding to fix the url, so the fixed request was never sent (the upload raised the original404, the download silently did nothing).transferred_sizewas not reset (e.g. 20/10 bytes).set_destination_url) instead of source url.Fix
text/htmlsuccess response from a non-API url as a missingapi/prefix (downloads only; API file endpoints never return HTML).whileloop where the endpoint fix does not count as an attempt.set_source_urlfor downloads.Reproduce
Testing notes
con.set_max_retries(1).api/behave as before.tests/test_transfer_api_prefix.pycovers the frontend page and upload auto-fix with a single attempt and correct progress.🤖 Generated with Claude Code