Skip to content

Commit

Permalink
[Release/1.45] Allow empty username + fix profiles on read (#23924) (#…
Browse files Browse the repository at this point in the history
…23928)

* Allow empty username + fix profiles on read (#23924)

* Bump STS
  • Loading branch information
cheenamalhotra authored Jul 19, 2023
1 parent ff10e3a commit 041bf75
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extensions/mssql/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "4.8.1.3",
"version": "4.8.1.5",
"downloadFileNames": {
"Windows_86": "win-x86-net7.0.zip",
"Windows_64": "win-x64-net7.0.zip",
Expand Down
6 changes: 6 additions & 0 deletions src/sql/platform/connection/common/connectionConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as nls from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { deepClone } from 'vs/base/common/objects';
import { isDisposable } from 'vs/base/common/lifecycle';
import { isUndefinedOrNull } from 'vs/base/common/types';

export const GROUPS_CONFIG_KEY = 'datasource.connectionGroups';
export const CONNECTIONS_CONFIG_KEY = 'datasource.connections';
Expand Down Expand Up @@ -241,6 +242,11 @@ export class ConnectionConfig {
profile.id = generateUuid();
changed = true;
}
// SSMS 19 requires "user", fix any profiles created without user property.
if (profile.providerName === 'MSSQL' && isUndefinedOrNull(profile.options.user)) {
profile.options.user = '';
changed = true;
}
idsCache[profile.id] = true;
}
return changed;
Expand Down
6 changes: 4 additions & 2 deletions src/sql/platform/connection/common/connectionProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ProviderConnectionInfo } from 'sql/platform/connection/common/providerC
import * as interfaces from 'sql/platform/connection/common/interfaces';
import { generateUuid } from 'vs/base/common/uuid';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { isString } from 'vs/base/common/types';
import { isString, isUndefinedOrNull } from 'vs/base/common/types';
import { deepClone } from 'vs/base/common/objects';
import * as Constants from 'sql/platform/connection/common/constants';
import { URI } from 'vs/base/common/uri';
Expand Down Expand Up @@ -359,7 +359,9 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
};

Object.keys(connectionInfo.options).forEach(element => {
if (connectionInfo.options[element] && connectionInfo.options[element] !== null && connectionInfo.options[element] !== '') {
// Allow empty strings to ensure "user": "" is populated if empty << Required by SSMS 19.2
// Do not change this design until SSMS 19 goes out of support.
if (!isUndefinedOrNull(connectionInfo.options[element])) {
profile.options[element] = connectionInfo.options[element];
}
});
Expand Down

0 comments on commit 041bf75

Please sign in to comment.