From 614beae48e8da589c4da6374f64925d1231d0048 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 8 Jun 2023 14:45:52 +0200 Subject: [PATCH] use base64 for urls (work some urls don't work otherwise) --- pandora/app/views.py | 8 +++----- static/js/utils.js | 5 ++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pandora/app/views.py b/pandora/app/views.py index 94e1c08cb..b6337b4b5 100644 --- a/pandora/app/views.py +++ b/pandora/app/views.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- - -import copy from datetime import datetime +import base64 +import copy from django.shortcuts import render, redirect from django.conf import settings @@ -53,9 +53,7 @@ def embed(request, id): }) def redirect_url(request, url): - if request.META['QUERY_STRING']: - url += "?" + request.META['QUERY_STRING'] - + url = base64.decodebytes(url.encode()).decode() if settings.CONFIG['site'].get('sendReferrer', False): return redirect(url) else: diff --git a/static/js/utils.js b/static/js/utils.js index 067822e5c..43eb0368a 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -2639,7 +2639,10 @@ pandora.openLink = function(url) { if (Ox.startsWith(url, 'mailto:')) { window.open(url); } else { - window.open('/url=' + encodeURIComponent(url), '_blank'); + if (!pandora.site.site.sendReferrer) { + url = '/url=' + btoa(url); + } + window.open(url, '_blank'); } };