From 939b9b91129dad4ea73cd39726035df3e106c1b8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 29 Jun 2023 21:26:33 +0300 Subject: [PATCH] Support "file://" scheme for the requested URL --- platformio/home/rpc/handlers/os.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio/home/rpc/handlers/os.py b/platformio/home/rpc/handlers/os.py index dd651193..57bbdcef 100644 --- a/platformio/home/rpc/handlers/os.py +++ b/platformio/home/rpc/handlers/os.py @@ -73,9 +73,9 @@ class OSRPC(BaseRPCHandler): async def request_content(self, uri, data=None, headers=None, cache_valid=None): if uri.startswith("http"): return await self.fetch_content(uri, data, headers, cache_valid) - if os.path.isfile(uri): - with io.open(uri, encoding="utf-8") as fp: - return fp.read() + local_path = uri[7:] if uri.startswith("file://") else uri + with io.open(local_path, encoding="utf-8") as fp: + return fp.read() return None @staticmethod