luci: format code
This commit is contained in:
parent
022688249d
commit
8848f801b6
@ -615,38 +615,38 @@ function parseURL(url)
|
||||
if not url or url == "" then
|
||||
return nil
|
||||
end
|
||||
local pattern = "^(%w+)://"
|
||||
local protocol = url:match(pattern)
|
||||
local pattern = "^(%w+)://"
|
||||
local protocol = url:match(pattern)
|
||||
|
||||
if not protocol then
|
||||
--error("Invalid URL: " .. url)
|
||||
return nil
|
||||
end
|
||||
if not protocol then
|
||||
--error("Invalid URL: " .. url)
|
||||
return nil
|
||||
end
|
||||
|
||||
local auth_host_port = url:sub(#protocol + 4)
|
||||
local auth_pattern = "^([^@]+)@"
|
||||
local auth = auth_host_port:match(auth_pattern)
|
||||
local username, password
|
||||
local auth_host_port = url:sub(#protocol + 4)
|
||||
local auth_pattern = "^([^@]+)@"
|
||||
local auth = auth_host_port:match(auth_pattern)
|
||||
local username, password
|
||||
|
||||
if auth then
|
||||
username, password = auth:match("^([^:]+):([^:]+)$")
|
||||
auth_host_port = auth_host_port:sub(#auth + 2)
|
||||
end
|
||||
if auth then
|
||||
username, password = auth:match("^([^:]+):([^:]+)$")
|
||||
auth_host_port = auth_host_port:sub(#auth + 2)
|
||||
end
|
||||
|
||||
local host, port = auth_host_port:match("^([^:]+):(%d+)$")
|
||||
local host, port = auth_host_port:match("^([^:]+):(%d+)$")
|
||||
|
||||
if not host or not port then
|
||||
--error("Invalid URL: " .. url)
|
||||
return nil
|
||||
end
|
||||
if not host or not port then
|
||||
--error("Invalid URL: " .. url)
|
||||
return nil
|
||||
end
|
||||
|
||||
return {
|
||||
protocol = protocol,
|
||||
username = username,
|
||||
password = password,
|
||||
host = host,
|
||||
port = tonumber(port)
|
||||
}
|
||||
return {
|
||||
protocol = protocol,
|
||||
username = username,
|
||||
password = password,
|
||||
host = host,
|
||||
port = tonumber(port)
|
||||
}
|
||||
end
|
||||
|
||||
local default_file_tree = {
|
||||
|
Loading…
Reference in New Issue
Block a user