Use normpath to allow for local symlinks
For DevTools [1] we advice contributors to symlink their repository into Chromium/src/. However, when locally running the `md_browser`, any files under `third_party/devtools-frontend/src/` don't show up, as the realpath would resolve the symlink after which `md_browser` aborts the request as it detects that the top-level directory is different. Instead of using realpath (which resolves symlinks and normalizes the path) we should be using normpath, which only does the latter. [1]: https://chromium.googlesource.com/devtools/devtools-frontend/+/refs/heads/master/README.md R=dpranke@chromium.org Change-Id: I8b64cfc3a51caf1f5d70b1fcb1bed80f95dd587e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2120577 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Nodir Turakulov <nodir@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Nodir Turakulov <nodir@chromium.org> Cr-Commit-Position: refs/heads/master@{#753226}
This commit is contained in:

committed by
Commit Bot

parent
ebe1e03972
commit
d9e2d52705
@ -141,7 +141,7 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
if path.startswith('/chromium/src/+/master'):
|
||||
path = path[len('/chromium/src/+/master'):]
|
||||
|
||||
full_path = os.path.realpath(os.path.join(self.server.top_level, path[1:]))
|
||||
full_path = os.path.normpath(os.path.join(self.server.top_level, path[1:]))
|
||||
|
||||
if not full_path.startswith(self.server.top_level):
|
||||
self._DoUnknown()
|
||||
|
Reference in New Issue
Block a user