Skip to content

Commit

Permalink
properly decode file:// urls given to ranger as argument (fixes range…
Browse files Browse the repository at this point in the history
  • Loading branch information
hut committed Aug 1, 2024
1 parent 784c94f commit bd9b37f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ranger/core/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import shutil
import sys
import tempfile
import urllib
from io import open
from logging import getLogger

Expand Down Expand Up @@ -257,7 +258,12 @@ def get_paths(args):
if args.paths:
prefix = 'file://'
prefix_length = len(prefix)
paths = [path[prefix_length:] if path.startswith(prefix) else path for path in args.paths]
paths = []
for path in args.paths:
if path.startswith(prefix):
paths.append(urllib.parse.unquote(urllib.parse.urlparse(path).path))
else:
paths.append(path)
else:
start_directory = os.environ.get('PWD')
is_valid_start_directory = start_directory and os.path.exists(start_directory)
Expand Down

0 comments on commit bd9b37f

Please sign in to comment.