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

use urllib for URIs #2900

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

use urllib for URIs #2900

wants to merge 1 commit into from

Conversation

gigamicro
Copy link

@gigamicro gigamicro commented Sep 14, 2023

fixes percent encoding being broken (eg when steam opens ranger as default file manager)
may break paths that are actually named in percent encoding (that are not themselves percent encoded)
i imagine there's a better way to do this but this seems to work so far

ISSUE TYPE

  • Bug fix
  • Improvement/feature implementation
  • Breaking changes
    (i feel like depending on definition it could be any or all of these)

RUNTIME ENVIRONMENT

  • Operating system and version: Linux Lite 5.4
  • Terminal emulator and version: alacritty 0.12.2
  • Python version: Python 3.8.10
  • Ranger version/commit: 136416c
  • Locale: en_US.UTF-8

CHECKLIST

  • The CONTRIBUTING document has been read [REQUIRED]
  • All changes follow the code style [REQUIRED] (at least as far as i can tell after reading it, the import from within a function seems odd but matches the rest of the file afaik)
  • All new and existing tests pass [REQUIRED]
  • Changes require config files to be updated
    • Config files have been updated
  • Changes require documentation to be updated
    • Documentation has been updated
  • Changes require tests to be updated
    • Tests have been updated

DESCRIPTION

uses urllib.parse.urlparse and urllib.parse.unquote to, respectively, parse the path from a URI and decode URI percent encoding
potential better way would be to only unquote() the path if it is actually a file:// uri but i literally do not know python

MOTIVATION AND CONTEXT

my previous fix was to make the exo preferred filemanager a shell script that removed the file:// and replaced %20's with spaces before passing any path to ranger (the current apt version of ranger has a bug where it removes the leading slash of file uris, but that was fixed by cloning the repo)

TESTING

"What tests have been run?"
make test_py; make test
"How does the changes affect other areas of the codebase?"
shouldn't, apart from changing the argument parsing

fixes percent encoding being broken (eg when steam opens ranger as default file manager)
may break paths that are actually named in percent encoding (that are not themselves percent encoded), i imagine there's a better way to do this but this seems to work so far
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant