mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-06 08:01:58 +02:00
Directories should have mime-type inode/directory.
This commit is contained in:
@@ -28,6 +28,8 @@ def is_rc_file(path: str) -> bool:
|
||||
name = os.path.basename(path)
|
||||
return '.' not in name and name.endswith('rc')
|
||||
|
||||
def is_folder(path: str) -> bool:
|
||||
return os.path.isdir(path)
|
||||
|
||||
def initialize_mime_database() -> None:
|
||||
if hasattr(initialize_mime_database, 'inited'):
|
||||
@@ -54,4 +56,6 @@ def guess_type(path: str) -> Optional[str]:
|
||||
mt = 'text/' + mt.split('/', 1)[-1]
|
||||
if not mt and is_rc_file(path):
|
||||
mt = 'text/plain'
|
||||
if not mt and is_folder(path):
|
||||
mt = 'inode/directory'
|
||||
return mt
|
||||
|
||||
Reference in New Issue
Block a user