fix error code for delete folder (#42470) (#42519)

(cherry picked from commit e13e6a7bd7)

Co-authored-by: ying-jeanne <74549700+ying-jeanne@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)andying-jeanne authored and GitHub committed 2021-11-30 14:21:31 +01:00
1 parent e4a85fb951
commit 9d6491be4f
2 files changed
+12

No files matched your search

+6
View File
@@ -692,9 +692,15 @@ func (l *LibraryElementService) deleteLibraryElementsInFolderUID(c context.Conte
if err != nil {
return err
}
if len(folderUIDs) == 0 {
return models.ErrFolderNotFound
}
if len(folderUIDs) != 1 {
return fmt.Errorf("found %d folders, while expecting at most one", len(folderUIDs))
}
folderID := folderUIDs[0].ID
if err := l.requirePermissionsOnFolder(c, signedInUser, folderID); err != nil {