wkentaro / gdown

Google Drive Public File Downloader when Curl/Wget Fails
MIT License
4.31k stars 350 forks source link

All logic relying on `os.path.sep` is wrong on Windows #314

Open RunDevelopment opened 9 months ago

RunDevelopment commented 9 months ago

Provide environment information

Python: 3.8.2 gdown: main

What OS are you using?

Windows 10

Describe the Bug

All the logic using os.path.sep is incorrect on Windows, because Windows paths treat / the same as a \. However, gdown only uses os.path.sep (which is \ on Windows) meaning that it treats perfectly valid paths incorrectly.

The underlying issue is that gdown assumes that the primary path separator is the only path separator, which is not true.

Example of an incorrect usage of os.path.sep to detect directory paths.

Expected Behavior

Support paths with both / and \ on Windows.

To Reproduce

No response

wkentaro commented 9 months ago

@RunDevelopment I don't own Windows computer so am not able to play around the difference of / and \. Can you propose a fix for it as a PR?

RunDevelopment commented 9 months ago

As I see it, #313 needs to be fixed before I can propose a fix. You just said that you have no way to verify that any fix I propose works. So there should at least be a test so a Windows CI runner can verify that my fix is correct.

So I'm currently working on #313.