thumbnail: Remove unused is_camo_url parameter.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-08-13 17:21:00 -07:00 committed by Tim Abbott
parent 4206e5f00b
commit 0b795e492f
3 changed files with 2 additions and 3 deletions

View File

@ -9,7 +9,6 @@ def zerver.views.auth.get_safe_redirect_to(url, redirect_host) -> Sanitize: ...
def zerver.lib.thumbnail.generate_thumbnail_url( def zerver.lib.thumbnail.generate_thumbnail_url(
path, path,
size=..., size=...,
is_camo_url=...
) -> Sanitize: ... ) -> Sanitize: ...
# This function returns a version of name that only contains word and space # This function returns a version of name that only contains word and space

View File

@ -17,7 +17,7 @@ def user_uploads_or_external(url: str) -> bool:
) )
def generate_thumbnail_url(path: str, size: str = "0x0", is_camo_url: bool = False) -> str: def generate_thumbnail_url(path: str, size: str = "0x0") -> str:
path = urljoin("/", path) path = urljoin("/", path)
if url_has_allowed_host_and_scheme(path, allowed_hosts=None): if url_has_allowed_host_and_scheme(path, allowed_hosts=None):

View File

@ -8,6 +8,6 @@ from zerver.lib.thumbnail import generate_thumbnail_url
def handle_camo_url(request: HttpRequest, digest: str, received_url: str) -> HttpResponse: def handle_camo_url(request: HttpRequest, digest: str, received_url: str) -> HttpResponse:
original_url = bytes.fromhex(received_url).decode() original_url = bytes.fromhex(received_url).decode()
if is_camo_url_valid(digest, original_url): if is_camo_url_valid(digest, original_url):
return redirect(generate_thumbnail_url(original_url, is_camo_url=True)) return redirect(generate_thumbnail_url(original_url))
else: else:
return HttpResponseForbidden("<p>Not a valid URL.</p>") return HttpResponseForbidden("<p>Not a valid URL.</p>")