Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix os.create failure, while the name of downloaded file is empty in offline_download #7041

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

xiaoqingwanga
Copy link
Contributor

Offline download with the SimpleHttp tool parses the filename from the requesting URL. However, if the path in the URL is empty, the filename is also empty (which is then transformed into ‘.’ by path.Base).
If the filename is empty, TempDir is set to the filename. Alist creates TempDir successfully, but os.Create fails to create the target file.
To resolve this, I assign a default name to the temp file based on the hostname, replacing all dots with underscores. This ensures that TempDir and the filename are never equal.

Copy link

welcome bot commented Aug 20, 2024

Thanks for opening this pull request! Please check out our contributing guidelines.

@xhofe xhofe merged commit 7488792 into AlistGo:main Aug 21, 2024
3 checks passed
Copy link

welcome bot commented Aug 21, 2024

Congrats on merging your first pull request! We here at behavior bot are proud of you!

@xiaoqingwanga xiaoqingwanga deleted the fix_filename_empty_fail branch August 22, 2024 01:08
Three-taile-dragon pushed a commit to loognsss/blist that referenced this pull request Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants