Skip to content

Commit e5eff0e

Browse files
authored
fix(FR-1469): use inclusive checking for GitHub host detection (#4284)
1 parent 298764e commit e5eff0e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/backend-ai-import-view.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,9 @@ export default class BackendAIImport extends BackendAIPage {
447447
const usageMode = 'general';
448448
const group = ''; // user ownership
449449
const vhost_info = await globalThis.backendaiclient.vfolder.list_hosts();
450+
const urlHost = new URL(url).host;
450451
let host = vhost_info.default;
451-
if (new URL(url).host === 'github.com') {
452+
if (urlHost === 'github.com' || urlHost === 'codeload.github.com') {
452453
host = (
453454
this.shadowRoot?.querySelector('#github-add-folder-host') as Select
454455
).value;
@@ -461,7 +462,7 @@ export default class BackendAIImport extends BackendAIPage {
461462
return globalThis.backendaiclient.vfolder
462463
.create(name, host, group, usageMode, permission)
463464
.then((value) => {
464-
if (new URL(url).host === 'github.com') {
465+
if (urlHost === 'github.com' || urlHost === 'codeload.github.com') {
465466
this.importNotebookMessage = _text('import.FolderName') + name;
466467
} else {
467468
this.importGitlabMessage = _text('import.FolderName') + name;
@@ -482,9 +483,10 @@ export default class BackendAIImport extends BackendAIPage {
482483
const vfolders = vfolderObj.map(function (value) {
483484
return value.name;
484485
});
486+
const urlHost = new URL(url).host;
485487
if (vfolders.includes(name)) {
486488
this.notification.text = _text('import.FolderAlreadyExists');
487-
if (new URL(url).host === 'github.com') {
489+
if (urlHost === 'github.com' || urlHost === 'codeload.github.com') {
488490
this.importNotebookMessage = this.notification.text;
489491
} else {
490492
this.importGitlabMessage = this.notification.text;

0 commit comments

Comments
 (0)