-
Notifications
You must be signed in to change notification settings - Fork 6k
Automatically URI encode asset keys #35270
Conversation
| dart_main = "fixtures/ui_test.dart" | ||
| fixtures = [ | ||
| "fixtures/DashInNooglerHat.jpg", | ||
| "fixtures/DashInNooglerHat%20WithSpace.jpg", |
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.
Since the fixtures are bundled as-is using file path as key, we need to simulate flutter tool encoding strategy by changing the file name.
zanderso
left a comment
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.
lgtm
|
|
|
||
| // Escape `%` and `#` characters according to doc comment at | ||
| // https://github.com/ninja-build/ninja/blob/master/src/depfile_parser.cc#L28 | ||
| static void EscapeString(std::string& str, std::stringstream& stream) { |
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.
CanCompileAndReflect here could have some logic added to it to emit and inspect the contents of the depfile.
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.
I gave it a shot...
impeller/compiler/compiler_test.cc
Outdated
| } | ||
| } | ||
|
|
||
| auto mapping = |
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.
Oh, my bad. I wasn't clear. The code here should output to the right file given the name of the fixture. Probably need to add a ReflectionDepfileName(). See how the other files are written out above. Also see here. Then the code in https://github.com/flutter/engine/blob/main/impeller/compiler/compiler_unittests.cc can pass a fixture with a %20 in the name, and inspect the depfile output.
zanderso
left a comment
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.
LGTM
Fixes flutter/flutter#109195
The flutter tool converts all asset keys with spaces into URI encoded paths (replacing ' ' with '%20', for example). Perform the same encoding in ImmutableBuffer.fromAsset and FragmentProgram.fromAsset so that users can load assets with the same key they have written in the pubspec.