mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-31 00:45:13 +08:00
✨ Sync 2026-09-11 23:47:18
This commit is contained in:
1 parent
be72c4a194
commit
8141aa4b54
89 files changed
+3680
-3045
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package.path = "./luasrc/?.lua;./luasrc/?/?.lua;" .. package.path
|
||||
|
||||
local console = require "openclaw.console"
|
||||
|
||||
local function assert_equal(actual, expected, message)
|
||||
if actual ~= expected then
|
||||
error((message or "values differ") .. ": expected=" .. tostring(expected) .. " actual=" .. tostring(actual))
|
||||
end
|
||||
end
|
||||
|
||||
assert_equal(console.normalize_https_url(" https://console.example.com/chat/ "), "https://console.example.com/chat", "valid HTTPS URL")
|
||||
assert_equal(console.normalize_https_url("http://console.example.com"), nil, "HTTP must be rejected")
|
||||
assert_equal(console.normalize_https_url("https://user@example.com"), nil, "userinfo must be rejected")
|
||||
assert_equal(console.normalize_https_url("https://example.com/a'b"), nil, "single quote must be rejected")
|
||||
assert_equal(console.normalize_https_url('https://example.com/a"b'), nil, "double quote must be rejected")
|
||||
assert_equal(console.normalize_https_url("https://example.com/</script>"), nil, "script delimiter must be rejected")
|
||||
assert_equal(console.normalize_https_url("https://example.com:70000"), nil, "invalid port must be rejected")
|
||||
assert_equal(console.normalize_https_url("https://[fd00::1]:8443/ui"), "https://[fd00::1]:8443/ui", "IPv6 URL")
|
||||
assert_equal(console.html_attr([[&<>"']]), "&<>"'", "HTML attribute escaping")
|
||||
|
||||
print("ok")
|
||||
Reference in new issue
Block a user