libsql-client-py icon indicating copy to clipboard operation
libsql-client-py copied to clipboard

URL decode path for files

Open penberg opened this issue 2 years ago • 4 comments

We currently don't support paths that have URL encoded spaces, for example:

file:///foo/bar%20baz/sqlite.db

Let's decode the URL before passing using it for path lookup.

penberg avatar Oct 18 '23 15:10 penberg

Hi! I would like to work on this issue as my first contribution. Can I go ahead?

gh-adithya avatar Oct 18 '23 19:10 gh-adithya

@gh-adithya Go for it!

penberg avatar Oct 19 '23 06:10 penberg

If I'm not wrong, this issue must have been resolved already. The relevant lines of code are:

 url_parsed = urllib.parse.urlparse(url)
 scheme = url_parsed.scheme
 authority = url_parsed.netloc
 path = url_parsed.path

This is from lines 21-24 in config.py

gh-adithya avatar Oct 19 '23 08:10 gh-adithya

@gh-adithya The path is still in the encoded format. You can test this yourself by trying to open a file with a space in the name in encoded format as shown above.

penberg avatar Oct 19 '23 09:10 penberg