Issue with os.path.join and upload function on Windows
epavanello opened this issue · comments
I found a bug when using the Python library on Windows. When I pass a path generated with os.path.join to the upload function, it generates an exception for "invalid characters". It seems that the function does not automatically replace the forward slash with the backslash, but instead sends it to the database as is.
This issue occurs only on Windows, as the forward slash is a valid path separator on Unix-based systems.
Steps to reproduce
- Generate a file path using os.path.join on a Windows system.
- Pass the generated path to the upload function.
- Observe the exception for "invalid characters".
Expected behavior
The upload function should automatically replace the forward slash with the backslash on Windows systems, as the backslash is the valid path separator on this platform.
Actual behavior
The upload function does not replace the forward slash with the backslash, causing an exception for "invalid characters".
Hey,
Thanks for flagging this - I think this will be fixed if we use pathlib
to convert the path to a posix path. I'm hoping to do this soon
There's no longer a need for this since we use _request()
which should resolve any confusion around paths. Let us know if there are still path related issues though.
Thanks
Upd: above is incorrect, get_public_url
is still needed
I want to test this out as I am on Windows, I know this is an old issue but can you provide a code example showing this issue please?
Closing this out as no steps were provided and I am unable to replicate on Windows 11.