icat: Add support for file:// URLs as well

This commit is contained in:
Kovid Goyal 2019-02-15 09:59:54 +05:30
parent c385532b10
commit 062563a562
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -339,6 +339,16 @@ def main(args=sys.argv):
item = tf.name
is_tempfile = True
process(item, args, is_tempfile)
elif item.lower().startswith('file://'):
from urllib.parse import urlparse
from urllib.request import url2pathname
item = urlparse(item)
if os.sep == '\\':
item = item.netloc + item.path
else:
item = item.path
item = url2pathname(item)
process(item, args, is_tempfile)
else:
if os.path.isdir(item):
for x in scan(item):