mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -06:00
Simplify reverse proxy path handling in redirect()
Remove redundant SRS check since SRS paths always start with SR. The first condition (SRS) is redundant because SRS = SR + "/", so any path starting with SRS will also start with SR. Closes #306(9001/copyparty#306)
This commit is contained in:
parent
1ebe06f51e
commit
f20113ea2c
|
@ -1106,7 +1106,18 @@ class HttpCli(object):
|
|||
status: int = 200,
|
||||
use302: bool = False,
|
||||
) -> bool:
|
||||
vp = self.args.SRS + vpath
|
||||
if self.args.R:
|
||||
if vpath.startswith(self.args.SR):
|
||||
vp = vpath
|
||||
elif vpath.startswith("/"):
|
||||
vp = self.args.SR + vpath
|
||||
else:
|
||||
vp = self.args.SRS + vpath
|
||||
else:
|
||||
if vpath.startswith("/"):
|
||||
vp = vpath
|
||||
else:
|
||||
vp = "/" + vpath if vpath else "/"
|
||||
html = self.j2s(
|
||||
"msg",
|
||||
h2='<a href="{}">{} {}</a>'.format(
|
||||
|
|
Loading…
Reference in a new issue