@@ 78,7 78,7 @@ class FormatDirView(BaseView):
"""
loop = asyncio.get_running_loop()
try:
- fmt = _get_format(self.repo(), self.request.match_info)
+ fmt = _get_format(self.repo(), self.request.match_info, delete=True)
await loop.run_in_executor(None, fmt.delete)
self.repo().schedule_cleanup_orphans()
except FileNotFoundError as e:
@@ 175,9 175,15 @@ class FormatFileView(BaseView):
# --------------------------------------------------------------------------------------
-def _get_format(repo, match_info, access_cb: Callable[[str], bool] = None):
+def _get_format(
+ repo, match_info, access_cb: Callable[[str], bool] = None, delete=False
+):
try:
if "product" in match_info:
+ if delete:
+ raise web.HTTPBadRequest(
+ reason="Deleting product formats is not supported"
+ )
fmt = (
repo.get_product(match_info["product"])
.get_variant(match_info["variant"])