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
96711b00
Unverified
Commit
96711b00
authored
Jun 12, 2020
by
Danny Tuppeny
Committed by
GitHub
Jun 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't crash on requests for invalid package URLs (#59250)
parent
3efc517a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
19 deletions
+30
-19
devfs_web.dart
packages/flutter_tools/lib/src/build_runner/devfs_web.dart
+7
-4
flutter_web_platform.dart
...ages/flutter_tools/lib/src/test/flutter_web_platform.dart
+16
-15
devfs_web_test.dart
.../flutter_tools/test/general.shard/web/devfs_web_test.dart
+7
-0
No files found.
packages/flutter_tools/lib/src/build_runner/devfs_web.dart
View file @
96711b00
...
@@ -517,12 +517,15 @@ class WebAssetServer implements AssetReader {
...
@@ -517,12 +517,15 @@ class WebAssetServer implements AssetReader {
// The file might have been a package file which is signaled by a
// The file might have been a package file which is signaled by a
// `/packages/<package>/<path>` request.
// `/packages/<package>/<path>` request.
if
(
segments
.
first
==
'packages'
)
{
if
(
segments
.
first
==
'packages'
)
{
final
File
packageFile
=
globals
.
fs
.
file
(
_packages
.
resolve
(
Uri
(
final
Uri
filePath
=
_packages
.
resolve
(
Uri
(
scheme:
'package'
,
pathSegments:
segments
.
skip
(
1
))));
scheme:
'package'
,
pathSegments:
segments
.
skip
(
1
)));
if
(
filePath
!=
null
)
{
final
File
packageFile
=
globals
.
fs
.
file
(
filePath
);
if
(
packageFile
.
existsSync
())
{
if
(
packageFile
.
existsSync
())
{
return
packageFile
;
return
packageFile
;
}
}
}
}
}
// Otherwise it must be a Dart SDK source or a Flutter Web SDK source.
// Otherwise it must be a Dart SDK source or a Flutter Web SDK source.
final
Directory
dartSdkParent
=
globals
.
fs
final
Directory
dartSdkParent
=
globals
.
fs
...
...
packages/flutter_tools/lib/src/test/flutter_web_platform.dart
View file @
96711b00
...
@@ -41,7 +41,6 @@ import '../dart/package_map.dart';
...
@@ -41,7 +41,6 @@ import '../dart/package_map.dart';
import
'../globals.dart'
as
globals
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
import
'../project.dart'
;
import
'../web/chrome.dart'
;
import
'../web/chrome.dart'
;
import
'test_compiler.dart'
;
import
'test_compiler.dart'
;
import
'test_config.dart'
;
import
'test_config.dart'
;
...
@@ -222,6 +221,7 @@ class FlutterWebPlatform extends PlatformPlugin {
...
@@ -222,6 +221,7 @@ class FlutterWebPlatform extends PlatformPlugin {
scheme:
'package'
,
scheme:
'package'
,
pathSegments:
request
.
requestedUri
.
pathSegments
.
skip
(
1
),
pathSegments:
request
.
requestedUri
.
pathSegments
.
skip
(
1
),
));
));
if
(
fileUri
!=
null
)
{
final
String
dirname
=
p
.
dirname
(
fileUri
.
toFilePath
());
final
String
dirname
=
p
.
dirname
(
fileUri
.
toFilePath
());
final
String
basename
=
p
.
basename
(
fileUri
.
toFilePath
());
final
String
basename
=
p
.
basename
(
fileUri
.
toFilePath
());
final
shelf
.
Handler
handler
=
createStaticHandler
(
dirname
);
final
shelf
.
Handler
handler
=
createStaticHandler
(
dirname
);
...
@@ -237,6 +237,7 @@ class FlutterWebPlatform extends PlatformPlugin {
...
@@ -237,6 +237,7 @@ class FlutterWebPlatform extends PlatformPlugin {
);
);
return
handler
(
modifiedRequest
);
return
handler
(
modifiedRequest
);
}
}
}
return
shelf
.
Response
.
notFound
(
'Not Found'
);
return
shelf
.
Response
.
notFound
(
'Not Found'
);
}
}
...
...
packages/flutter_tools/test/general.shard/web/devfs_web_test.dart
View file @
96711b00
...
@@ -364,6 +364,13 @@ void main() {
...
@@ -364,6 +364,13 @@ void main() {
expect
(
response
.
statusCode
,
HttpStatus
.
notFound
);
expect
(
response
.
statusCode
,
HttpStatus
.
notFound
);
}));
}));
test
(
'handles serving unresolvable package file'
,
()
=>
testbed
.
run
(()
async
{
final
Response
response
=
await
webAssetServer
.
handleRequest
(
Request
(
'GET'
,
Uri
.
parse
(
'http://foobar/packages/notpackage/file'
)));
expect
(
response
.
statusCode
,
HttpStatus
.
notFound
);
}));
test
(
'serves /packages/<package>/<path> files as if they were '
test
(
'serves /packages/<package>/<path> files as if they were '
'package:<package>/<path> uris'
,
()
=>
testbed
.
run
(()
async
{
'package:<package>/<path> uris'
,
()
=>
testbed
.
run
(()
async
{
final
Uri
expectedUri
=
packages
.
resolve
(
final
Uri
expectedUri
=
packages
.
resolve
(
...
...
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