summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/file-uri.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/script/file-uri.lua b/script/file-uri.lua
index f9ede668..3e916acf 100644
--- a/script/file-uri.lua
+++ b/script/file-uri.lua
@@ -92,8 +92,17 @@ function m.split(uri)
return uri:match('([^:]*):/?/?([^/]*)(.*)')
end
+---@param uri string
+---@return boolean
function m.isValid(uri)
- return m.split(uri) ~= nil
+ local scheme, authority, path = m.split(uri)
+ if not scheme or scheme == '' then
+ return false
+ end
+ if path == '' then
+ return false
+ end
+ return true
end
function m.normalize(uri)