Skip to content

Commit

Permalink
Merge pull request #10728 from nextcloud/bug/noid/handle-204-response
Browse files Browse the repository at this point in the history
fix: handle 204 response
  • Loading branch information
kesselb authored Feb 20, 2025
2 parents da31b72 + 0014941 commit cc97a50
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 @@ -17,22 +17,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 cc97a50

Please sign in to comment.