Skip to content

Commit 2c23dd4

Browse files
authored
Merge pull request #25352 from nextcloud/backport/25185/stable20
[stable20] Show the actual error on share requests
2 parents d7f6a48 + a2476e1 commit 2c23dd4

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

apps/files_sharing/js/dist/files_sharing_tab.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/files_sharing/js/dist/files_sharing_tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/files_sharing/src/mixins/ShareRequests.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ export default {
5959
return new Share(request.data.ocs.data)
6060
} catch (error) {
6161
console.error('Error while creating share', error)
62-
OC.Notification.showTemporary(t('files_sharing', 'Error creating the share'), { type: 'error' })
62+
const errorMessage = error?.response?.data?.ocs?.meta?.message
63+
OC.Notification.showTemporary(
64+
errorMessage ? t('files_sharing', 'Error creating the share: {errorMessage}', { errorMessage }) : t('files_sharing', 'Error creating the share'),
65+
{ type: 'error' }
66+
)
6367
throw error
6468
}
6569
},
@@ -79,7 +83,11 @@ export default {
7983
return true
8084
} catch (error) {
8185
console.error('Error while deleting share', error)
82-
OC.Notification.showTemporary(t('files_sharing', 'Error deleting the share'), { type: 'error' })
86+
const errorMessage = error?.response?.data?.ocs?.meta?.message
87+
OC.Notification.showTemporary(
88+
errorMessage ? t('files_sharing', 'Error deleting the share: {errorMessage}', { errorMessage }) : t('files_sharing', 'Error deleting the share'),
89+
{ type: 'error' }
90+
)
8391
throw error
8492
}
8593
},
@@ -100,7 +108,11 @@ export default {
100108
} catch (error) {
101109
console.error('Error while updating share', error)
102110
if (error.response.status !== 400) {
103-
OC.Notification.showTemporary(t('files_sharing', 'Error updating the share'), { type: 'error' })
111+
const errorMessage = error?.response?.data?.ocs?.meta?.message
112+
OC.Notification.showTemporary(
113+
errorMessage ? t('files_sharing', 'Error updating the share: {errorMessage}', { errorMessage }) : t('files_sharing', 'Error updating the share'),
114+
{ type: 'error' }
115+
)
104116
}
105117
const message = error.response.data.ocs.meta.message
106118
throw new Error(message)

0 commit comments

Comments
 (0)