Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
3bb4ba61
Unverified
Commit
3bb4ba61
authored
Feb 15, 2020
by
Jonah Williams
Committed by
GitHub
Feb 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] use uri resolution for asset requests (#50844)
parent
238dac14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
devfs_web.dart
packages/flutter_tools/lib/src/build_runner/devfs_web.dart
+3
-5
devfs_web_test.dart
.../flutter_tools/test/general.shard/web/devfs_web_test.dart
+14
-0
No files found.
packages/flutter_tools/lib/src/build_runner/devfs_web.dart
View file @
3bb4ba61
...
...
@@ -157,11 +157,9 @@ class WebAssetServer implements AssetReader {
// If all of the lookups above failed, the file might have been an asset.
// Try and resolve the path relative to the built asset directory.
if
(!
file
.
existsSync
())
{
final
String
assetPath
=
requestPath
.
replaceFirst
(
'/assets/'
,
''
);
file
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
getAssetBuildDirectory
(),
globals
.
fs
.
path
.
relative
(
assetPath
)),
);
final
Uri
potential
=
globals
.
fs
.
directory
(
getAssetBuildDirectory
())
.
uri
.
resolve
(
requestPath
.
replaceFirst
(
'/assets/'
,
''
));
file
=
globals
.
fs
.
file
(
potential
);
}
if
(!
file
.
existsSync
())
{
...
...
packages/flutter_tools/test/general.shard/web/devfs_web_test.dart
View file @
3bb4ba61
...
...
@@ -150,6 +150,20 @@ void main() {
Platform:
()
=>
windows
,
}));
test
(
'serves asset files from in filesystem with url-encoded paths'
,
()
=>
testbed
.
run
(()
async
{
final
File
source
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'build'
,
'flutter_assets'
,
Uri
.
encodeFull
(
'abcd象形字.png'
)))
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
kTransparentImage
);
final
Response
response
=
await
webAssetServer
.
handleRequest
(
Request
(
'GET'
,
Uri
.
parse
(
'http://foobar/assets/abcd%25E8%25B1%25A1%25E5%25BD%25A2%25E5%25AD%2597.png'
)));
expect
(
response
.
headers
,
allOf
(<
Matcher
>[
containsPair
(
'content-length'
,
source
.
lengthSync
().
toString
()),
containsPair
(
'content-type'
,
'image/png'
),
]));
expect
((
await
response
.
read
().
toList
()).
first
,
source
.
readAsBytesSync
());
}));
test
(
'serves asset files from in filesystem with known mime type on Windows'
,
()
=>
testbed
.
run
(()
async
{
final
File
source
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'build'
,
'flutter_assets'
,
'foo.png'
))
..
createSync
(
recursive:
true
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment