Skip to content
Snippets Groups Projects
Commit 54f99491 authored by Luna Mendes's avatar Luna Mendes
Browse files

api.files: use purge_cf

parent 3583ddf5
Branches 1-testing
No related tags found
No related merge requests found
import os
import logging import logging
from sanic import Blueprint from sanic import Blueprint
from sanic import response from sanic import response
from ..common import purge_cf_cache_file, purge_cf_cache_shorten from ..common import purge_cf, FileNameType
from ..common_auth import token_check from ..common_auth import token_check
from ..errors import NotFound from ..errors import NotFound
...@@ -83,7 +84,7 @@ async def delete_handler(request): ...@@ -83,7 +84,7 @@ async def delete_handler(request):
if exec_out == "UPDATE 0": if exec_out == "UPDATE 0":
raise NotFound('You have no files with this name.') raise NotFound('You have no files with this name.')
await purge_cf_cache_file(request.app, file_name) await purge_cf(request.app, file_name, FileNameType.FILE)
return response.json({ return response.json({
'success': True 'success': True
...@@ -109,7 +110,7 @@ async def shortendelete_handler(request): ...@@ -109,7 +110,7 @@ async def shortendelete_handler(request):
if exec_out == "UPDATE 0": if exec_out == "UPDATE 0":
raise NotFound('You have no shortens with this name.') raise NotFound('You have no shortens with this name.')
await purge_cf_cache_shorten(request.app, file_name) await purge_cf(request.app, file_name, FileNameType.SHORTEN)
return response.json({ return response.json({
'success': True 'success': True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment