mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 17:22:20 -05:00
Add validation for new file names for sql projects (#21601)
* Add validation for new file names for sql projects * Addres comments and add validation for new project dialog * Address comments * Address comments on test * Fix tests * Remove extra error messages and rename file * Address comments * Fix tests * Add test file back
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import * as constants from '../common/constants';
|
||||
import { exists, getVscodeMssqlApi } from '../common/utils';
|
||||
import { exists, getVscodeMssqlApi, isValidBasename, isValidBasenameErrorMessage, sanitizeStringForFilename } from '../common/utils';
|
||||
import { IConnectionInfo } from 'vscode-mssql';
|
||||
import { defaultProjectNameFromDb, defaultProjectSaveLocation } from '../tools/newProjectTool';
|
||||
import { ImportDataModel } from '../models/api/import';
|
||||
@@ -70,9 +70,9 @@ export async function createNewProjectFromDatabaseWithQuickpick(connectionInfo?:
|
||||
const projectName = await vscode.window.showInputBox(
|
||||
{
|
||||
title: constants.projectNamePlaceholderText,
|
||||
value: defaultProjectNameFromDb(selectedDatabase),
|
||||
value: defaultProjectNameFromDb(sanitizeStringForFilename(selectedDatabase)),
|
||||
validateInput: (value) => {
|
||||
return value ? undefined : constants.nameMustNotBeEmpty;
|
||||
return isValidBasename(value) ? undefined : isValidBasenameErrorMessage(value);
|
||||
},
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user