-
Notifications
You must be signed in to change notification settings - Fork 211
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
Handle AssetIds with invalid URI characters #1140
Conversation
Fixes #1134 Rewrite the URI encoding for AssetId to be more robust by using the built in URI escaping when using `pathSegments` instead of `path`. Delete a duplicate of the AssetId test file.
We had talked about just throwing away any file path that had an invalid character, but I think this is probably the better fix. |
@@ -1,71 +0,0 @@ | |||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
were the rest of these all dupes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, the other ones in this directory are testing build_runner stuff.
final scheme = isLib ? 'package' : 'asset'; | ||
final pathSegments = isLib ? originalSegments.skip(1) : originalSegments; | ||
return new Uri( | ||
scheme: scheme, pathSegments: [id.package]..addAll(pathSegments)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so pathSegments
escapes and path
doesn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path
escapes some stuff, but not everything. It leaves delimiters, even when they are invalid.
https://github.com/dart-lang/sdk/blob/80a571d5460bbc734e709d7437af2c7df11e582a/sdk/lib/core/uri.dart#L85
pathSegments
escapes everything which is, I think, what we want.
Fixes #1134
Rewrite the URI encoding for AssetId to be more robust by using the
built in URI escaping when using
pathSegments
instead ofpath
.Delete a duplicate of the AssetId test file.