Skip to content

Commit 9a62200

Browse files
committed
fix: fix 500 when check-app has bad url
1 parent d8dc3ac commit 9a62200

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/backend/src/api/APIError.js

+4
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ module.exports = class APIError {
482482
status: 422,
483483
message: 'This share can not be applied to this user.',
484484
},
485+
'no_origin_for_app': {
486+
status: 400,
487+
message: 'Puter apps must have a valid URL.'
488+
},
485489

486490
// Chat
487491
// TODO: specifying these errors here might be a violation

src/backend/src/services/auth/AuthService.js

+3
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ class AuthService extends BaseService {
442442

443443
async app_uid_from_origin (origin) {
444444
origin = this._origin_from_url(origin);
445+
if ( origin === null ) {
446+
throw APIError.create('no_origin_for_app');
447+
}
445448
return await this._app_uid_from_origin(origin);
446449
}
447450

0 commit comments

Comments
 (0)