Skip to content

Commit

Permalink
Merge branch 'main' into serializer_bug_1745
Browse files Browse the repository at this point in the history
  • Loading branch information
Faakhir30 authored Oct 1, 2024
2 parents 594d27b + 7a5fcf1 commit 7de6017
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/plone/restapi/services/aliases/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import plone.protect.interfaces
import logging

logger = logging.getLogger("Plone")
logger = logging.getLogger(__name__)


@implementer(IPublishTraverse)
Expand Down Expand Up @@ -94,11 +94,16 @@ def _reply_csv(self):
form = self.request.form
if not form.get("file"):
raise BadRequest("No file uploaded")

file = form["file"]

if file.headers.get("Content-Type") not in ("text/csv", "application/csv"):
raise BadRequest("Uploaded file is not a valid CSV file")

controlpanel = RedirectsControlPanel(self.context, self.request)
storage = getUtility(IRedirectionStorage)
status = IStatusMessage(self.request)
portal = getSite()
file = form["file"]
controlpanel.upload(file, portal, storage, status)
file.close()

Expand Down

0 comments on commit 7de6017

Please sign in to comment.