Check for dirs when getting mimetypes in a couple more places
This commit is contained in:
parent
ac6224563b
commit
d052b020fa
@ -155,7 +155,7 @@ def sanitize(text: str) -> str:
|
|||||||
|
|
||||||
@lru_cache(maxsize=1024)
|
@lru_cache(maxsize=1024)
|
||||||
def mime_type_for_path(path: str) -> str:
|
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)
|
@lru_cache(maxsize=1024)
|
||||||
|
|||||||
@ -478,7 +478,7 @@ def complete_icat_args(ans: Completions, opt: Optional[OptionDict], prefix: str,
|
|||||||
from .guess_mime_type import guess_type
|
from .guess_mime_type import guess_type
|
||||||
|
|
||||||
def icat_file_predicate(filename: str) -> bool:
|
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/'):
|
if mt and mt.startswith('image/'):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user