mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
Fix encoding of uris for data protocol (#6723)
* fix encoding or uris * fix tests
This commit is contained in:
@@ -13,11 +13,11 @@ const msInH = 3.6e6;
|
||||
const msInM = 60000;
|
||||
const msInS = 1000;
|
||||
export const uriPrefixes = {
|
||||
default: 'connection://',
|
||||
connection: 'connection://',
|
||||
dashboard: 'dashboard://',
|
||||
insights: 'insights://',
|
||||
notebook: 'notebook://'
|
||||
default: 'connection:',
|
||||
connection: 'connection:',
|
||||
dashboard: 'dashboard:',
|
||||
insights: 'insights:',
|
||||
notebook: 'notebook:'
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
let connectionToUse = connection ? connection : connectionProfile;
|
||||
return new Promise<IConnectionResult>((resolve, reject) => {
|
||||
let id = connectionToUse.getOptionsKey();
|
||||
let defaultUri = 'connection://' + (id ? id : connectionToUse.serverName + ':' + connectionToUse.databaseName);
|
||||
let defaultUri = 'connection:' + (id ? id : connectionToUse.serverName + ':' + connectionToUse.databaseName);
|
||||
connectionManagementService.onConnectionRequestSent(() => {
|
||||
let info: azdata.ConnectionInfoSummary = {
|
||||
connectionId: error ? undefined : 'id',
|
||||
|
||||
@@ -228,7 +228,7 @@ suite('SQL ConnectionStatusManager tests', () => {
|
||||
//Verify database name changed after connection is complete
|
||||
connections.updateDatabaseName(summary);
|
||||
connectionStatus = connections.findConnection(connection3Id);
|
||||
let ownerUriWithDbName = Utils.generateUriWithPrefix(connectionStatus.connectionProfile, 'connection://');
|
||||
let ownerUriWithDbName = Utils.generateUriWithPrefix(connectionStatus.connectionProfile, 'connection:');
|
||||
|
||||
//The uri assigned to connection without db name should be the original one
|
||||
let connectionWitDbStatus = connections.getOriginalOwnerUri(ownerUriWithDbName);
|
||||
|
||||
@@ -195,7 +195,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
// Connection Management handlers
|
||||
$connect(handle: number, connectionUri: string, connection: azdata.ConnectionInfo): Thenable<boolean> {
|
||||
if (this.uriTransformer) {
|
||||
connectionUri = URI.from(this.uriTransformer.transformIncoming(URI.parse(connectionUri))).toString();
|
||||
connectionUri = URI.from(this.uriTransformer.transformIncoming(URI.parse(connectionUri))).toString(true);
|
||||
}
|
||||
return this._resolveProvider<azdata.ConnectionProvider>(handle).connect(connectionUri, connection);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
|
||||
$onConnectComplete(handle: number, connectionInfoSummary: azdata.ConnectionInfoSummary): void {
|
||||
if (this.uriTransformer) {
|
||||
connectionInfoSummary.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(connectionInfoSummary.ownerUri))).toString();
|
||||
connectionInfoSummary.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(connectionInfoSummary.ownerUri))).toString(true);
|
||||
}
|
||||
this._proxy.$onConnectionComplete(handle, connectionInfoSummary);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
|
||||
$runQuery(handle: number, ownerUri: string, selection: azdata.ISelectionData, runOptions?: azdata.ExecutionPlanOptions): Thenable<void> {
|
||||
if (this.uriTransformer) {
|
||||
ownerUri = URI.from(this.uriTransformer.transformIncoming(URI.parse(ownerUri))).toString();
|
||||
ownerUri = URI.from(this.uriTransformer.transformIncoming(URI.parse(ownerUri))).toString(true);
|
||||
}
|
||||
return this._resolveProvider<azdata.QueryProvider>(handle).runQuery(ownerUri, selection, runOptions);
|
||||
}
|
||||
@@ -292,51 +292,51 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
|
||||
$getQueryRows(handle: number, rowData: azdata.QueryExecuteSubsetParams): Thenable<azdata.QueryExecuteSubsetResult> {
|
||||
if (this.uriTransformer) {
|
||||
rowData.ownerUri = URI.from(this.uriTransformer.transformIncoming(URI.parse(rowData.ownerUri))).toString();
|
||||
rowData.ownerUri = URI.from(this.uriTransformer.transformIncoming(URI.parse(rowData.ownerUri))).toString(true);
|
||||
}
|
||||
return this._resolveProvider<azdata.QueryProvider>(handle).getQueryRows(rowData);
|
||||
}
|
||||
|
||||
$disposeQuery(handle: number, ownerUri: string): Thenable<void> {
|
||||
if (this.uriTransformer) {
|
||||
ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(ownerUri))).toString();
|
||||
ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(ownerUri))).toString(true);
|
||||
}
|
||||
return this._resolveProvider<azdata.QueryProvider>(handle).disposeQuery(ownerUri);
|
||||
}
|
||||
|
||||
$onQueryComplete(handle: number, result: azdata.QueryExecuteCompleteNotificationResult): void {
|
||||
if (this.uriTransformer) {
|
||||
result.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(result.ownerUri))).toString();
|
||||
result.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(result.ownerUri))).toString(true);
|
||||
}
|
||||
this._proxy.$onQueryComplete(handle, result);
|
||||
}
|
||||
$onBatchStart(handle: number, batchInfo: azdata.QueryExecuteBatchNotificationParams): void {
|
||||
if (this.uriTransformer) {
|
||||
batchInfo.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(batchInfo.ownerUri))).toString();
|
||||
batchInfo.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(batchInfo.ownerUri))).toString(true);
|
||||
}
|
||||
this._proxy.$onBatchStart(handle, batchInfo);
|
||||
}
|
||||
$onBatchComplete(handle: number, batchInfo: azdata.QueryExecuteBatchNotificationParams): void {
|
||||
if (this.uriTransformer) {
|
||||
batchInfo.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(batchInfo.ownerUri))).toString();
|
||||
batchInfo.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(batchInfo.ownerUri))).toString(true);
|
||||
}
|
||||
this._proxy.$onBatchComplete(handle, batchInfo);
|
||||
}
|
||||
$onResultSetAvailable(handle: number, resultSetInfo: azdata.QueryExecuteResultSetNotificationParams): void {
|
||||
if (this.uriTransformer) {
|
||||
resultSetInfo.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(resultSetInfo.ownerUri))).toString();
|
||||
resultSetInfo.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(resultSetInfo.ownerUri))).toString(true);
|
||||
}
|
||||
this._proxy.$onResultSetAvailable(handle, resultSetInfo);
|
||||
}
|
||||
$onResultSetUpdated(handle: number, resultSetInfo: azdata.QueryExecuteResultSetNotificationParams): void {
|
||||
if (this.uriTransformer) {
|
||||
resultSetInfo.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(resultSetInfo.ownerUri))).toString();
|
||||
resultSetInfo.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(resultSetInfo.ownerUri))).toString(true);
|
||||
}
|
||||
this._proxy.$onResultSetUpdated(handle, resultSetInfo);
|
||||
}
|
||||
$onQueryMessage(handle: number, message: azdata.QueryExecuteMessageParams): void {
|
||||
if (this.uriTransformer) {
|
||||
message.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(message.ownerUri))).toString();
|
||||
message.ownerUri = URI.from(this.uriTransformer.transformOutgoing(URI.parse(message.ownerUri))).toString(true);
|
||||
}
|
||||
this._proxy.$onQueryMessage(handle, message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user