From 4174d5acaff9d1ff5c169052f155efb4c7b3c4ba Mon Sep 17 00:00:00 2001 From: Matt Irvine Date: Wed, 29 Nov 2017 12:22:03 -0800 Subject: [PATCH] Work around URI parsing issue for Windows drives (#558) --- src/Microsoft.SqlTools.ServiceLayer/Workspace/Workspace.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Workspace/Workspace.cs b/src/Microsoft.SqlTools.ServiceLayer/Workspace/Workspace.cs index ac78f510..910c03a9 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Workspace/Workspace.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Workspace/Workspace.cs @@ -133,6 +133,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace { if (filePath.StartsWith(@"file://")) { + // VS Code encodes the ':' character in the drive name, which can lead to problems parsing + // the URI, so unencode it if present. See https://github.com/Microsoft/vscode/issues/2990 + filePath = filePath.Replace("%3A/", ":/", StringComparison.OrdinalIgnoreCase); + // Client sent the path in URI format, extract the local path and trim // any extraneous slashes Uri fileUri = new Uri(filePath);