From d052b020fabc2fdcd80f68dcc9782e5ddb3f4fb9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Jul 2021 21:49:02 +0530 Subject: [PATCH] Check for dirs when getting mimetypes in a couple more places --- kittens/diff/collect.py | 2 +- kitty/complete.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kittens/diff/collect.py b/kittens/diff/collect.py index 47d16af57..0f479c35a 100644 --- a/kittens/diff/collect.py +++ b/kittens/diff/collect.py @@ -155,7 +155,7 @@ def sanitize(text: str) -> str: @lru_cache(maxsize=1024) def mime_type_for_path(path: str) -> str: - return guess_type(path) or 'application/octet-stream' + return guess_type(path, allow_filesystem_access=True) or 'application/octet-stream' @lru_cache(maxsize=1024) diff --git a/kitty/complete.py b/kitty/complete.py index 48fdec998..5b4863f6a 100644 --- a/kitty/complete.py +++ b/kitty/complete.py @@ -478,7 +478,7 @@ def complete_icat_args(ans: Completions, opt: Optional[OptionDict], prefix: str, from .guess_mime_type import guess_type def icat_file_predicate(filename: str) -> bool: - mt = guess_type(filename) + mt = guess_type(filename, allow_filesystem_access=True) if mt and mt.startswith('image/'): return True return False