icat kitten: Fix a regression that broke passing directories to icat

Fixes #1683
This commit is contained in:
Kovid Goyal 2019-06-05 07:36:47 +05:30
parent c509ecca52
commit c0a96f2087
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 4 deletions

View File

@ -22,6 +22,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- panel kitten: Fix the contents of the panel kitten not being positioned
correctly on the vertical axis
- icat kitten: Fix a regression that broke passing directories to icat
(:iss:`1683`)
- Linux: Disable the Wayland backend on GNOME by default as GNOME has no
support for server side decorations. Can be controlled by
:opt:`linux_display_server`.

View File

@ -270,7 +270,7 @@ help_text = (
usage = 'image-file-or-url-or-directory ...'
def process_single_item(item, args, url_pat, maybe_dir=True):
def process_single_item(item, args, url_pat=None, maybe_dir=True):
is_tempfile = False
try:
if isinstance(item, bytes):
@ -278,7 +278,7 @@ def process_single_item(item, args, url_pat, maybe_dir=True):
tf.write(item), tf.close()
item = tf.name
is_tempfile = True
if url_pat.match(item) is not None:
if url_pat is not None and url_pat.match(item) is not None:
from urllib.request import urlretrieve
with NamedTemporaryFile(prefix='url-image-data-', delete=False) as tf:
try:
@ -300,8 +300,8 @@ def process_single_item(item, args, url_pat, maybe_dir=True):
process(item, args, is_tempfile)
else:
if maybe_dir and os.path.isdir(item):
for x in scan(item):
process_single_item(item, args, url_pat, maybe_dir=False)
for (x, mt) in scan(item):
process_single_item(x, args, url_pat=None, maybe_dir=False)
else:
process(item, args, is_tempfile)
finally: