mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-12-25 17:08:22 +01:00
Support URLsafe base 64 encoding in API gateway
This commit is contained in:
parent
6d3ee13d87
commit
fd31477739
@ -194,7 +194,14 @@ function SystemController:apigateway(...)
|
||||
data = JSON.decodeString(REQUEST.json)
|
||||
exec_with_user_priv(data)
|
||||
elseif args and #args > 0 then
|
||||
local decoded = std.b64decode(args[1])
|
||||
-- data is encoded in url safe base64
|
||||
local encoded = args[1]:gsub('_', '/'):gsub('-', '+')
|
||||
if #encoded % 4 == 2 then
|
||||
encoded = encoded.."=="
|
||||
elseif #encoded %4 == 3 then
|
||||
encoded = encoded.."="
|
||||
end
|
||||
local decoded = std.b64decode(encoded)
|
||||
data = JSON.decodeString(bytes.__tostring(decoded))
|
||||
if data and data.path then
|
||||
exec_with_user_priv(data)
|
||||
|
Loading…
Reference in New Issue
Block a user