From 211b9689e8a0d6f8e8e53730f5ce5768004cef9f Mon Sep 17 00:00:00 2001 From: Stamnug <987004590@qq.com> Date: Sun, 22 Dec 2024 19:45:28 +0800 Subject: [PATCH] Update types.py --- plugin/core/types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin/core/types.py b/plugin/core/types.py index fafed05c4..deb8e2368 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -872,6 +872,15 @@ def map_uri_on_payload(self, payload: Any, is_from_client_to_server: bool) -> An return payload + def map_client_path_to_server_uri(self, path: str) -> str: + return self.map_uri_on_payload(filename_to_uri(path), is_from_client_to_server=True) + + def map_server_uri_to_client_path(self, uri: str) -> str: + scheme, path = parse_uri(self.map_uri_on_payload(uri, is_from_client_to_server=False)) + if scheme not in ("file", "res"): + raise ValueError(f"{uri}: {scheme} URI scheme is unsupported") + return path + def is_disabled_capability(self, capability_path: str) -> bool: for value in self.disabled_capabilities.walk(capability_path): if isinstance(value, bool):