diff --git a/internal/handlers/library.go b/internal/handlers/library.go index 9282fda..94241e0 100644 --- a/internal/handlers/library.go +++ b/internal/handlers/library.go @@ -175,10 +175,11 @@ func (h *LibraryHandler) AddLibraryFolder(c echo.Context) error { } // Validate that folder path exists and is accessible - if _, err := os.Stat(req.FolderPath); os.IsNotExist(err) { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "folder path does not exist"}) - } + _, err = os.Stat(req.FolderPath) if err != nil { + if os.IsNotExist(err) { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "folder path does not exist"}) + } return c.JSON(http.StatusBadRequest, map[string]string{"error": "folder is not accessible"}) }