diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index b8bf472f0..d34fe074a 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -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 = {