diff --git a/app.py b/app.py index 9ed4622..25c2d56 100644 --- a/app.py +++ b/app.py @@ -236,8 +236,9 @@ def microblogpub_jsonld(): ) -@app.route("/p/") -def proxy(url: str) -> Any: +@app.route("/p//") +def proxy(scheme: str, url: str) -> Any: + url = f"{scheme}://{url}" req_headers = { k: v for k, v in dict(request.headers).items() diff --git a/utils/template_filters.py b/utils/template_filters.py index 7c61d49..72d2c71 100644 --- a/utils/template_filters.py +++ b/utils/template_filters.py @@ -248,11 +248,11 @@ def _get_file_url(url, size, kind) -> str: _FILE_URL_CACHE[k] = out return out - # MEDIA_CACHE.cache(url, kind) _logger.error(f"cache not available for {url}/{size}/{kind}") if url.startswith(BASE_URL): return url - return f"/p/{url}" + p = urlparse(url) + return f"/p/{p.scheme}" + p._replace(scheme="").geturl()[1:] @filters.app_template_filter()