Skip to content

Commit ed8d0e1

Browse files
committed
fix file delete view
1 parent f03accc commit ed8d0e1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

files/views.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ def delete(self, request, *args, **kwargs):
3030
"""deletes the file (only if the request is sent by the user who owns it!)
3131
The link has to be specified in the JSON body, not in the URL arguments.
3232
"""
33-
if request.data and (request.data.get("link") is not None):
34-
link = request.data.get("link")
33+
# get the link from the query
34+
if request.query_params and (request.query_params.get("link") is not None):
35+
link = request.query_params.get("link")
3536
else:
3637
return Response(
3738
{
38-
"error": "you have to pass the link of the object you want to delete as JSON"
39+
"error": "you have to pass the link of the object you want to delete in query parameters"
3940
},
4041
status=status.HTTP_400_BAD_REQUEST,
4142
)

0 commit comments

Comments
 (0)