use base64 for urls (work some urls don't work otherwise)

This commit is contained in:
j 2023-06-08 14:45:52 +02:00
parent 19bd818461
commit 614beae48e
2 changed files with 7 additions and 6 deletions

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import copy
from datetime import datetime from datetime import datetime
import base64
import copy
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.conf import settings from django.conf import settings
@ -53,9 +53,7 @@ def embed(request, id):
}) })
def redirect_url(request, url): def redirect_url(request, url):
if request.META['QUERY_STRING']: url = base64.decodebytes(url.encode()).decode()
url += "?" + request.META['QUERY_STRING']
if settings.CONFIG['site'].get('sendReferrer', False): if settings.CONFIG['site'].get('sendReferrer', False):
return redirect(url) return redirect(url)
else: else:

View file

@ -2639,7 +2639,10 @@ pandora.openLink = function(url) {
if (Ox.startsWith(url, 'mailto:')) { if (Ox.startsWith(url, 'mailto:')) {
window.open(url); window.open(url);
} else { } else {
window.open('/url=' + encodeURIComponent(url), '_blank'); if (!pandora.site.site.sendReferrer) {
url = '/url=' + btoa(url);
}
window.open(url, '_blank');
} }
}; };