Trim server name (#1308)

* add warning for trimming of the servername and trim the servername before connection

* move the location of the trim

* move it back to simplify tests
This commit is contained in:
Anthony Dresser
2018-05-02 10:16:05 -07:00
committed by GitHub
parent e82b7615b3
commit 31ac8d6acc
3 changed files with 27 additions and 13 deletions

View File

@@ -17,6 +17,7 @@ import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { localize } from 'vs/nls';
import { entries } from 'sql/base/common/objects';
import * as sqlops from 'sqlops';
@@ -32,7 +33,7 @@ import { IWindowsService } from 'vs/platform/windows/common/windows';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import * as types from 'vs/base/common/types';
import { entries } from 'sql/base/common/objects';
import { trim } from 'vs/base/common/strings';
export interface IConnectionValidateResult {
isValid: boolean;
@@ -108,6 +109,8 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
profile = result.connection;
profile.serverName = trim(profile.serverName);
// append the port to the server name for SQL Server connections
if (this.getCurrentProviderName() === Constants.mssqlProviderName) {
let portPropertyName: string = 'port';
@@ -125,6 +128,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
this.handleDefaultOnConnect(params, profile);
} else {
profile.serverName = trim(profile.serverName);
this._connectionManagementService.addSavedPassword(profile).then(connectionWithPassword => {
this.handleDefaultOnConnect(params, connectionWithPassword);
});