When reloading configuration, also reload mime.types

This commit is contained in:
pagedown 2023-02-12 17:28:42 +08:00
parent 64fe9f82ed
commit 4141872290
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB
3 changed files with 9 additions and 0 deletions

View File

@ -50,6 +50,8 @@ Detailed list of changes
- Linux: Reduce minimum required OpenGL version from 3.3 to 3.1 + extensions (:iss:`2790`)
- When reloading configuration, also reload custom MIME types from :file:`mime.types` config file (:pull:`6012`)
0.27.1 [2023-02-07]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -2385,6 +2385,8 @@ class Boss:
self.apply_new_options(opts)
from .open_actions import clear_caches
clear_caches()
from .guess_mime_type import clear_mime_cache
clear_mime_cache()
def safe_delete_temp_file(self, path: str) -> None:
if is_path_in_temp_dir(path):

View File

@ -60,6 +60,11 @@ def initialize_mime_database() -> None:
init((local_defs,))
def clear_mime_cache() -> None:
if hasattr(initialize_mime_database, 'inited'):
delattr(initialize_mime_database, 'inited')
def guess_type(path: str, allow_filesystem_access: bool = False) -> Optional[str]:
is_dir = is_exe = False