server: fix problems with escaping

This commit is contained in:
rr- 2017-01-21 00:12:28 +01:00
parent 1acceb941d
commit 6b42d787a7
3 changed files with 6 additions and 5 deletions

View file

@ -159,13 +159,14 @@ the one in the `config.yaml`, so that client knows how to access the backend!
server {
listen 80;
server_name great.dude;
merge_slashes off; # to support post tags such as ///
location ~ ^/api$ {
return 302 /api/;
}
location ~ ^/api/(.*)$ {
proxy_pass http://127.0.0.1:6666/$1$is_args$args;
if ($request_uri ~* "/api/(.*)") { # preserve PATH_INFO as-is
proxy_pass http://127.0.0.1:6666/$1;
}
}
location / {
root /home/rr-/src/maintained/szurubooru/client/public;

View file

@ -24,11 +24,11 @@ function formatApiLink(...values) {
}
function escapeParam(text) {
return encodeURIComponent(text).replace(/%/g, '$');
return encodeURIComponent(text);
}
function unescapeParam(text) {
return decodeURIComponent(text.replace(/\$/g, '%'));
return decodeURIComponent(text);
}
function formatClientLink(...values) {

View file

@ -31,7 +31,7 @@ def _get_headers(env):
def _create_context(env):
method = env['REQUEST_METHOD']
path = urllib.parse.unquote('/' + env['PATH_INFO'].lstrip('/'))
path = '/' + env['PATH_INFO'].lstrip('/')
headers = _get_headers(env)
files = {}