mirror of
https://github.com/get-drexa/drive.git
synced 2025-12-06 16:21:39 +00:00
fix: handle create dir conflict in api
This commit is contained in:
@@ -79,6 +79,9 @@ func (h *HTTPHandler) createDirectory(c *fiber.Ctx) error {
|
||||
|
||||
node, err := h.vfs.CreateDirectory(c.Context(), h.db, account.ID, parent.ID, req.Name)
|
||||
if err != nil {
|
||||
if errors.Is(err, virtualfs.ErrNodeConflict) {
|
||||
return c.Status(fiber.StatusConflict).JSON(fiber.Map{"error": "Directory already exists"})
|
||||
}
|
||||
return httperr.Internal(err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user