properly handle case where ngx.var.args is nil
This commit is contained in:
parent
e998882ca8
commit
b3f1d05031
|
@ -355,7 +355,8 @@ location ~ "^/(([a-zA-Z0-9-_]{46}|[a-z0-9]{55})(/.*)?)$" {
|
||||||
rewrite_by_lua_block {
|
rewrite_by_lua_block {
|
||||||
local skynet_skylink = require("skynet.skylink")
|
local skynet_skylink = require("skynet.skylink")
|
||||||
local base32_skylink = skynet_skylink.base32(ngx.var.skylink)
|
local base32_skylink = skynet_skylink.base32(ngx.var.skylink)
|
||||||
local base32_url = ngx.var.scheme .. "://" .. base32_skylink .. "." .. ngx.var.skynet_portal_domain .. ngx.var.path .. ngx.var.is_args .. ngx.var.args
|
local args = ngx.var.args and ngx.var.is_args .. ngx.var.args or ""
|
||||||
|
local base32_url = ngx.var.scheme .. "://" .. base32_skylink .. "." .. ngx.var.skynet_portal_domain .. ngx.var.path .. args
|
||||||
|
|
||||||
return ngx.redirect(base32_url, ngx.HTTP_MOVED_PERMANENTLY)
|
return ngx.redirect(base32_url, ngx.HTTP_MOVED_PERMANENTLY)
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue