Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>
<PropertyGroup>
<VersionPrefix>17.9.4</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind>
<VersionPrefix>17.9.5</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind>
<PackageValidationBaselineVersion>17.8.3</PackageValidationBaselineVersion>
<AssemblyVersion>15.1.0.0</AssemblyVersion>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
Expand Down
28 changes: 28 additions & 0 deletions src/Tasks/ManifestUtil/PathUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ public static string Format(string path)

string resolvedPath = Resolve(path);
Uri u = new Uri(resolvedPath);
//
// GB18030: Uri class does not correctly encode chars in the PUA range for implicit
// file paths (paths without explicit scheme):
// https://github.com/dotnet/runtime/issues/89538
// Workaround is to use UriBuilder with the file scheme specified explicitly to
// correctly encode the PUA chars.
//
if (Uri.UriSchemeFile.Equals(u.Scheme, StringComparison.OrdinalIgnoreCase) &&
!IsAsciiString(resolvedPath))
{
UriBuilder builder = new UriBuilder()
{
Scheme = Uri.UriSchemeFile,
Host = string.Empty,
Path = resolvedPath,
};
u = builder.Uri;
}
return u.AbsoluteUri;
}

Expand Down Expand Up @@ -209,5 +227,15 @@ public static string Resolve(string path)
// if not unc or url then it must be a local disk path...
return Path.GetFullPath(path); // make sure it's a full path
}

private static bool IsAsciiString(string str)
{
foreach (char c in str)
{
if (c > 127)
{ return false; }
}
return true;
}
}
}