mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Support "file://" scheme for the requested URL
This commit is contained in:
@ -73,9 +73,9 @@ class OSRPC(BaseRPCHandler):
|
|||||||
async def request_content(self, uri, data=None, headers=None, cache_valid=None):
|
async def request_content(self, uri, data=None, headers=None, cache_valid=None):
|
||||||
if uri.startswith("http"):
|
if uri.startswith("http"):
|
||||||
return await self.fetch_content(uri, data, headers, cache_valid)
|
return await self.fetch_content(uri, data, headers, cache_valid)
|
||||||
if os.path.isfile(uri):
|
local_path = uri[7:] if uri.startswith("file://") else uri
|
||||||
with io.open(uri, encoding="utf-8") as fp:
|
with io.open(local_path, encoding="utf-8") as fp:
|
||||||
return fp.read()
|
return fp.read()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Reference in New Issue
Block a user