mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-02 01:49:51 +08:00
feat(core): improve auth handling (#15271)
fix #15270 fix #15260 fix #15257 #### PR Dependency Tree * **PR #15271** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
@@ -280,12 +280,24 @@ export const USER_FRIENDLY_ERRORS = {
|
||||
args: { reason: 'string' },
|
||||
message: ({ reason }) => {
|
||||
switch (reason) {
|
||||
case 'invalid_url':
|
||||
return 'Invalid URL';
|
||||
case 'disallowed_protocol':
|
||||
return 'URL protocol is not allowed';
|
||||
case 'url_has_credentials':
|
||||
return 'URL must not contain credentials';
|
||||
case 'blocked_hostname':
|
||||
return 'URL hostname is not allowed';
|
||||
case 'host_not_allowed':
|
||||
return 'URL hostname is outside the allowed hosts';
|
||||
case 'unresolvable_hostname':
|
||||
return 'Failed to resolve hostname';
|
||||
case 'blocked_ip':
|
||||
return 'URL resolves to a private or reserved IP address';
|
||||
case 'too_many_redirects':
|
||||
return 'Too many redirects';
|
||||
default:
|
||||
return 'Invalid URL';
|
||||
return `URL blocked by SSRF protection: ${reason}`;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user