Merge pull request #1697 from SkynetLabs/escape-uri-on-subdomain-skylink-requests

escape uri on subdomain skylink requests
This commit is contained in:
Karol Wypchło 2022-02-09 17:38:54 +01:00 committed by GitHub
commit e503b93aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1 @@
- fixed a bug when accessing file from skylink via subdomain with a filename that had escaped characters

View File

@ -6,7 +6,12 @@ include /etc/nginx/conf.d/include/init-optional-variables;
location / { location / {
set_by_lua_block $skylink { return string.match(ngx.var.host, "%w+") } set_by_lua_block $skylink { return string.match(ngx.var.host, "%w+") }
set $path $uri; set_by_lua_block $path {
-- strip ngx.var.request_uri from query params - this is basically the same as ngx.var.uri but
-- do not use ngx.var.uri because it will already be unescaped and we need to use escaped path
-- examples: escaped uri "/b%20r56+7" and unescaped uri "/b r56 7"
return string.gsub(ngx.var.request_uri, "?.*", "")
}
include /etc/nginx/conf.d/include/location-skylink; include /etc/nginx/conf.d/include/location-skylink;
} }