Skip to content

Commit 8a6dd62

Browse files
Merge pull request #10730 from nextcloud/backport/10728/stable3.7
[stable3.7] fix: handle 204 response
2 parents ad7b1de + 6104c58 commit 8a6dd62

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/service/AvatarService.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,18 @@ export const fetchAvatarUrl = (email) => {
3434
})
3535

3636
return Axios.get(url, { adapter: 'fetch', fetchOptions: { priority: 'low' } })
37-
.then((resp) => resp.data)
38-
.then((avatar) => {
39-
if (avatar.isExternal) {
37+
.then(res => {
38+
if (res.status === 204) {
39+
return undefined
40+
}
41+
42+
if (res.data.isExternal) {
4043
return generateUrl('/apps/mail/api/avatars/image/{email}', {
4144
email,
4245
})
43-
} else {
44-
return avatar.url
45-
}
46-
})
47-
.catch((err) => {
48-
if (err.response.status === 404) {
49-
return undefined
5046
}
5147

52-
return Promise.reject(err)
48+
return res.data.url
5349
})
5450
}
5551

0 commit comments

Comments
 (0)