From 351934b9edc7d05fe05b2abfe8b08f45160ed6ca Mon Sep 17 00:00:00 2001 From: retoor Date: Tue, 26 Nov 2024 05:56:12 +0000 Subject: [PATCH] fix: correct upload URL replacement logic to handle edge cases with trailing slashes The previous implementation incorrectly sliced the URL from the message by starting at the found index without accounting for the length of the upload URL, causing malformed anchor tags when the URL contained trailing slashes. This fix adjusts the slicing to start after the full upload URL string and properly escapes double quotes in the href attribute. --- src/rupload/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rupload/app.py b/src/rupload/app.py index f04d52e..1686607 100644 --- a/src/rupload/app.py +++ b/src/rupload/app.py @@ -266,8 +266,8 @@ async def handle_index(request: web.Request): if request.app.is_upload_folder_quota_reached: message = "Server reached quota! Contact administrator." if request.app.upload_url in message: - url = message[message.find(request.app.upload_url) :] - message = message.replace(request.app.upload_url, f' {url}' if message: message += "

"