Exemplo n.º 1
0
def generate_unauthed_file_access_url(path_id: str) -> str:
    signed_data = TimestampSigner(
        salt=LOCAL_FILE_ACCESS_TOKEN_SALT).sign(path_id)
    token = base64.b16encode(signed_data.encode("utf-8")).decode("utf-8")

    filename = path_id.split("/")[-1]
    return reverse("local_file_unauthed", args=[token, filename])
Exemplo n.º 2
0
def generate_unauthed_file_access_url(path_id: str) -> str:
    signed_data = TimestampSigner(
        salt=LOCAL_FILE_ACCESS_TOKEN_SALT).sign(path_id)
    token = base64.b16encode(signed_data.encode('utf-8')).decode('utf-8')

    filename = path_id.split('/')[-1]
    return reverse('zerver.views.upload.serve_local_file_unauthed',
                   args=[token, filename])