Skip to content

Commit

Permalink
fix: Remove license errors in open-source project version (#1847)
Browse files Browse the repository at this point in the history
* fix: Exclude 404 status from `throw` target

* fix: Return `resolve(false)` when `url-not-found`

* fix: Change to treat a 404 from `informantion.tsx`

* fix: Change `getLicense`'s logic
  • Loading branch information
Choi-Jiwon-38 authored Aug 14, 2023
1 parent 1debfdc commit d2a5840
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/lib/backend.ai-client-esm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4229,13 +4229,20 @@ class Enterprise {
if (this.client.is_superadmin === true) {
if (typeof this.certificate === 'undefined') {
const rqst = this.client.newSignedRequest('GET', '/license');
let cert = await this.client._wrapWithPromise(rqst);
this.certificate = cert.certificate;
this.certificate['valid'] = cert.status === 'valid';
let cert = await this.client._wrapWithPromise(rqst).catch((e: any) => {
if (e.statusCode == 404) {
// The open-source project version does not have a certificate.
return Promise.resolve(null);
}
})
if (cert) {
this.certificate = cert.certificate;
this.certificate['valid'] = cert.status === 'valid';
}
return Promise.resolve(this.certificate);
}
} else {
return Promise.resolve(false);
return Promise.resolve(undefined);
}
}
}
Expand Down

0 comments on commit d2a5840

Please sign in to comment.