mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 19:26:25 +00:00
get_root
docs
This commit is contained in:
parent
612cbb583a
commit
c8b9a0265a
@ -152,6 +152,17 @@ def parse_offset_arg(offset):
|
||||
|
||||
|
||||
def get_root(req):
|
||||
"""
|
||||
Get a relative path with parent directory segments that refers to the root
|
||||
location known to the given request. This seems a lot like the constant
|
||||
absolute path **/** but it will behave differently if the Tahoe-LAFS HTTP
|
||||
server is reverse-proxied and mounted somewhere other than at the root.
|
||||
|
||||
:param twisted.web.iweb.IRequest req: The request to consider.
|
||||
|
||||
:return: A string like ``../../..`` with the correct number of segments to
|
||||
reach the root.
|
||||
"""
|
||||
depth = len(req.prepath) + len(req.postpath)
|
||||
link = "/".join([".."] * depth)
|
||||
return link
|
||||
|
Loading…
Reference in New Issue
Block a user