Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape output item specs for ResolvePackageAssets task. #3112

Merged
merged 1 commit into from
Apr 13, 2019

Conversation

peterhuene
Copy link
Contributor

This commit fixes the ResolvePackageAssets task to escape the output
item specs. This allows assets in packages to contain characters that
might get unescaped by MSBuild.

Fixes #3069.

@peterhuene peterhuene added this to the 3.0.1xx milestone Apr 11, 2019
@peterhuene peterhuene requested a review from a team April 11, 2019 05:40
@nguerrera
Copy link
Contributor

@nkolev92 So why does ContentFilesExample use %2B in contentFiles, when the common pattern is an actual + in lib?

image

Looking at this msbuild code has me thinking there are probably a lot of bugs around files and directories with names like that across the stack.

Copy link
Contributor

@nguerrera nguerrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a minimum, I'd like to make sure we don't slow down the incremental case (which I think we can fix by putting the escaped value in the cache and not escaping on read from the cache).

I'm also very curious to hear @rainersigwald's take because I'm guessing there have been a bunch of bugs on what happens to ItemSpec's on get. Is there a recommended pattern around that in general?

Finally, I'd like to understand if the ContentFileExample is representative of a real-world use case. Why is that package using %2B instead of + like all the other packages I've seen?

@rainersigwald
Copy link
Member

Escaping is indeed a bug farm, even inside the engine. I think it makes sense to escape before passing to the item constructor, and that it makes sense to do that once, not for every incremental build.

I also agree that NuGet's behavior that spawned this is surprising.

Sorta related: dotnet/msbuild#2178

This commit fixes the ResolvePackageAssets task to escape the output
item specs.  This allows assets in packages to contain characters that
might get unescaped by MSBuild.

Fixes dotnet#3069.
@peterhuene peterhuene merged commit 8ad6b4e into dotnet:master Apr 13, 2019
@peterhuene peterhuene deleted the fix-resolve-package-assets branch April 13, 2019 00:00
dsplaisted pushed a commit to dsplaisted/sdk that referenced this pull request Feb 19, 2020
….3 (dotnet#3112)

- Microsoft.NET.Sdk - 3.1.100-preview1.19505.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProduceContentAssets should not "url decode" paths provided by NuGet
5 participants