(self)
| 11 | strip_prefix = "" |
| 12 | |
| 13 | def translate_path(self): |
| 14 | path = unquote(urlparse(self.path).path).lstrip("/") |
| 15 | if self.strip_prefix and path == self.strip_prefix: |
| 16 | path = "" |
| 17 | elif self.strip_prefix and path.startswith(self.strip_prefix + "/"): |
| 18 | path = path[len(self.strip_prefix) + 1:] |
| 19 | return (self.root / path).resolve() |
| 20 | |
| 21 | def send_file(self, head_only=False): |
| 22 | file_path = self.translate_path() |