Skip to content

Commit

Permalink
Merge pull request #10730 from nextcloud/backport/10728/stable3.7
Browse files Browse the repository at this point in the history
[stable3.7] fix: handle 204 response
  • Loading branch information
ChristophWurst authored Feb 20, 2025
2 parents ad7b1de + 6104c58 commit 8a6dd62
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/service/AvatarService.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,18 @@ export const fetchAvatarUrl = (email) => {
})

return Axios.get(url, { adapter: 'fetch', fetchOptions: { priority: 'low' } })
.then((resp) => resp.data)
.then((avatar) => {
if (avatar.isExternal) {
.then(res => {
if (res.status === 204) {
return undefined
}

if (res.data.isExternal) {
return generateUrl('/apps/mail/api/avatars/image/{email}', {
email,
})
} else {
return avatar.url
}
})
.catch((err) => {
if (err.response.status === 404) {
return undefined
}

return Promise.reject(err)
return res.data.url
})
}

Expand Down

0 comments on commit 8a6dd62

Please sign in to comment.