mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-08-21 10:55:48 +02:00
copilot fix
This commit is contained in:
@@ -54,7 +54,7 @@ end
|
|||||||
local function decode_jwt_payload(value)
|
local function decode_jwt_payload(value)
|
||||||
-- Three dot-separated base64url segments; the signature may be empty (alg:none).
|
-- Three dot-separated base64url segments; the signature may be empty (alg:none).
|
||||||
local payload = value:match("^[A-Za-z0-9_-]+%.([A-Za-z0-9_-]+)%.[A-Za-z0-9_-]*$")
|
local payload = value:match("^[A-Za-z0-9_-]+%.([A-Za-z0-9_-]+)%.[A-Za-z0-9_-]*$")
|
||||||
if not payload then
|
if not payload or #payload > 8192 then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local decoded = b64url_decode(payload)
|
local decoded = b64url_decode(payload)
|
||||||
@@ -65,7 +65,7 @@ local function decode_jwt_payload(value)
|
|||||||
if decoded:match("^%s*{") == nil then
|
if decoded:match("^%s*{") == nil then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
decoded = decoded:gsub("[\r\n]+", " ")
|
decoded = decoded:gsub("[%c]+", " ")
|
||||||
return decoded
|
return decoded
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user