From 87170d4bac02658503bf08285f0c8268e0d69dc7 Mon Sep 17 00:00:00 2001 From: beavailable Date: Mon, 3 Oct 2022 10:01:12 +0800 Subject: [PATCH] Fix infinite redirection --- share.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share.py b/share.py index 7793acd..6a2fd52 100755 --- a/share.py +++ b/share.py @@ -337,7 +337,10 @@ def split_path(self, path): parts.pop() elif p and p != '.': parts.append(p) - return ('/' + '/'.join(parts), query) + collapsed_path = '/' + '/'.join(parts) + if path != '/' and path.endswith('/'): + collapsed_path += '/' + return (collapsed_path, query) def respond_for_file(self, file): include_content_disposition = self._is_from_commandline()