Skip to content

Commit 5d4f75b

Browse files
committed
fix: testproj need to be with a dot
1 parent 8170c46 commit 5d4f75b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

extensions/ql-vscode/src/databases/local-databases-ui.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -980,14 +980,14 @@ export class DatabaseUI extends DisposableObject {
980980
byFolder: boolean,
981981
progress: ProgressCallback,
982982
): Promise<DatabaseItem | undefined> {
983-
if (byFolder && !uri.fsPath.endsWith("testproj")) {
983+
if (byFolder && !uri.fsPath.endsWith(".testproj")) {
984984
const fixedUri = await this.fixDbUri(uri);
985985
// we are selecting a database folder
986986
return await this.databaseManager.openDatabase(fixedUri, {
987987
type: "folder",
988988
});
989989
} else {
990-
// we are selecting a database archive or a testproj.
990+
// we are selecting a database archive or a .testproj.
991991
// Unzip archives (if an archive) and copy into a workspace-controlled area
992992
// before importing.
993993
return await this.databaseFetcher.importLocalDatabase(
@@ -1028,6 +1028,7 @@ export class DatabaseUI extends DisposableObject {
10281028
const databases: DatabaseItem[] = [];
10291029
const failures: string[] = [];
10301030
const entries = await workspace.fs.readDirectory(uri);
1031+
const validFileTypes = [FileType.File, FileType.Directory];
10311032

10321033
for (const [index, entry] of entries.entries()) {
10331034
progress({
@@ -1044,10 +1045,19 @@ export class DatabaseUI extends DisposableObject {
10441045
});
10451046
};
10461047

1048+
if (!validFileTypes.includes(entry[1])) {
1049+
void this.app.logger.log(
1050+
`Skip import ${entry}, invalid FileType: ${entry[1]}`,
1051+
);
1052+
continue;
1053+
}
1054+
10471055
try {
1048-
const fixedUri = await this.fixDbUri(Uri.joinPath(uri, entry[0]));
1056+
const databaseUri = Uri.joinPath(uri, entry[0]);
1057+
void this.app.logger.log(`Importing from ${databaseUri}`);
1058+
10491059
const database = await this.importDatabase(
1050-
fixedUri,
1060+
databaseUri,
10511061
entry[1] === FileType.Directory,
10521062
subProgress,
10531063
);
@@ -1056,7 +1066,7 @@ export class DatabaseUI extends DisposableObject {
10561066
} else {
10571067
failures.push(entry[0]);
10581068
}
1059-
} catch (e) {
1069+
} catch {
10601070
failures.push(entry[0]);
10611071
}
10621072
}

0 commit comments

Comments
 (0)