fix: arbitrary file suppression

This commit is contained in:
imperosol committed 2026-10-26 23:00:54 +01:00
1 parent c6f518fffb
commit f11ac5d3be
1 file changed
+4 -5
+4 -5
View File
@@ -269,7 +269,7 @@ class FileView(CanViewMixin, DetailView, FormMixin):
form_class = AddFilesForm form_class = AddFilesForm
@staticmethod @staticmethod
def handle_clipboard(request, obj): def handle_clipboard(request, obj: SithFile):
"""Handle the clipboard in the view. """Handle the clipboard in the view.
This method can fail, since it does not catch the exceptions coming from This method can fail, since it does not catch the exceptions coming from
@@ -283,10 +283,9 @@ class FileView(CanViewMixin, DetailView, FormMixin):
where you want to paste the clipboard where you want to paste the clipboard
""" """
if "delete" in request.POST: if "delete" in request.POST:
for f_id in request.POST.getlist("file_list"): file_ids = request.POST.getlist("file_list")
file = SithFile.objects.filter(id=f_id).first() for file in obj.children.filter(id__in=file_ids):
if file: file.delete()
file.delete()
if "clear" in request.POST: if "clear" in request.POST:
request.session["clipboard"] = [] request.session["clipboard"] = []
if "cut" in request.POST: if "cut" in request.POST: