(self, path)
| 542 | |
| 543 | # Return {address: 1Site.., inner_path: /data/users.json} from url path |
| 544 | def parsePath(self, path): |
| 545 | path = path.replace("\\", "/") |
| 546 | path = path.replace("/index.html/", "/") # Base Backward compatibility fix |
| 547 | if path.endswith("/"): |
| 548 | path = path + "index.html" |
| 549 | |
| 550 | if "../" in path or "./" in path: |
| 551 | raise SecurityError("Invalid path") |
| 552 | |
| 553 | match = re.match(r"/media/(?P<address>[A-Za-z0-9]+[A-Za-z0-9\._-]+)(?P<inner_path>/.*|$)", path) |
| 554 | if match: |
| 555 | path_parts = match.groupdict() |
| 556 | path_parts["request_address"] = path_parts["address"] # Original request address (for Merger sites) |
| 557 | path_parts["inner_path"] = path_parts["inner_path"].lstrip("/") |
| 558 | if not path_parts["inner_path"]: |
| 559 | path_parts["inner_path"] = "index.html" |
| 560 | return path_parts |
| 561 | else: |
| 562 | return None |
| 563 | |
| 564 | # Serve a media for site |
| 565 | def actionSiteMedia(self, path, header_length=True, header_noscript=False): |
no test coverage detected