summaryrefslogtreecommitdiff
path: root/server-beta/src/file-uri.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/file-uri.lua')
-rw-r--r--server-beta/src/file-uri.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/server-beta/src/file-uri.lua b/server-beta/src/file-uri.lua
index e58a86eb..8acd4f64 100644
--- a/server-beta/src/file-uri.lua
+++ b/server-beta/src/file-uri.lua
@@ -38,6 +38,9 @@ local m = {}
-- /usr/home --> file:///usr/home
-- \\server\share\some\path --> file://server/share/some/path
+--- path -> uri
+---@param path string
+---@return string uri
function m.encode(path)
local authority = ''
if platform.OS == 'Windows' then
@@ -77,6 +80,9 @@ end
-- file:///usr/home --> /usr/home
-- file://server/share/some/path --> \\server\share\some\path
+--- uri -> path
+---@param uri string
+---@return string path
function m.decode(uri)
local scheme, authority, path = uri:match('([^:]*):?/?/?([^/]*)(.*)')
if not scheme then