When url and filename are the same, urlretrieve() will wipe out data in the file
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
If url and filename points to the same local file, the original file will be replaced by an empty file when executing
tfp = open(filename, 'wb')
and a ContentTooShortError will be raised as the file content is no longer available.
I suppose it should either do nothing or raise an exception during such circumstances.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with urlretrieve() and reproduce the case where the URL and filename refer to the same local file, focusing on the open(filename, 'wb') path described in the report. Define and verify one consistent outcome for this case—leaving the file unchanged or raising an exception—without losing its original contents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100