From 0df86cfc2b9271d441de9d1b5d410e9f948494fe Mon Sep 17 00:00:00 2001 From: Wasi Master Date: Fri, 15 May 2026 05:07:30 +0600 Subject: [PATCH] Use query param for /status and unquote URL for vercel support Change the /status endpoint to accept the target URL via a query parameter instead of a path component. Update client-side EventSource to call /status?url=... and import urllib.parse.unquote to decode the incoming URL. Return a 400 error when the url param is missing. This avoids routing/encoding issues with encoded URLs. --- app/portable.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/portable.py b/app/portable.py index 6924f5a..76ccec2 100644 --- a/app/portable.py +++ b/app/portable.py @@ -7,7 +7,7 @@ import uuid import threading import time from functools import lru_cache -from urllib.parse import urljoin, urlparse, quote +from urllib.parse import urljoin, urlparse, quote, unquote from flask import request, Response from bs4 import BeautifulSoup @@ -435,7 +435,7 @@ html = """ elapsedEl.textContent = UI_STRINGS.elapsed_template.replace('{seconds}', sec); }, 500); - const evtSource = new EventSource('/status/' + encodeURIComponent(link)); + const evtSource = new EventSource('/status?url=' + encodeURIComponent(link)); evtSource.addEventListener('step', function(e) { const data = JSON.parse(e.data); @@ -752,8 +752,14 @@ def main_page(): return render_main_page() -@app.route("/status/") -def status_stream(url): +@app.route("/status") +def status_stream(): + raw_url = request.args.get("url", "") + url = unquote(raw_url) + + if not url: + return "Missing URL", 400 + strings = load_strings() job_id = str(uuid.uuid4()) with jobs_lock: