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
a67df9e1
Unverified
Commit
a67df9e1
authored
Jan 18, 2018
by
Michael Goderbauer
Committed by
GitHub
Jan 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash during artifact download (#14147)
parent
bf7cc096
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
cache.dart
packages/flutter_tools/lib/src/cache.dart
+4
-3
cache_test.dart
packages/flutter_tools/test/cache_test.dart
+8
-0
No files found.
packages/flutter_tools/lib/src/cache.dart
View file @
a67df9e1
...
...
@@ -290,7 +290,7 @@ abstract class CachedArtifact {
/// Download an archive from the given [url] and unzip it to [location].
Future
<
Null
>
_downloadArchive
(
String
message
,
Uri
url
,
Directory
location
,
bool
verifier
(
File
f
),
void
extractor
(
File
f
,
Directory
d
))
{
return
_withDownloadFile
(
'
${
_
flattenNameSubdirs(url)}
'
,
(
File
tempFile
)
async
{
return
_withDownloadFile
(
'
${flattenNameSubdirs(url)}
'
,
(
File
tempFile
)
async
{
if
(!
verifier
(
tempFile
))
{
final
Status
status
=
logger
.
startProgress
(
message
,
expectSlowOperation:
true
);
await
_downloadFile
(
url
,
tempFile
).
then
<
Null
>((
_
)
{
...
...
@@ -516,9 +516,10 @@ String _flattenNameNoSubdirs(String fileName) {
return
new
String
.
fromCharCodes
(
replacedCodeUnits
);
}
String
_flattenNameSubdirs
(
Uri
url
)
{
@visibleForTesting
String
flattenNameSubdirs
(
Uri
url
)
{
final
List
<
String
>
pieces
=
<
String
>[
url
.
host
]..
addAll
(
url
.
pathSegments
);
final
List
<
String
>
convertedPieces
=
pieces
.
map
(
_flattenNameNoSubdirs
);
final
Iterable
<
String
>
convertedPieces
=
pieces
.
map
(
_flattenNameNoSubdirs
);
return
fs
.
path
.
joinAll
(
convertedPieces
);
}
...
...
packages/flutter_tools/test/cache_test.dart
View file @
a67df9e1
...
...
@@ -77,6 +77,14 @@ void main() {
verify
(
artifact2
.
update
());
});
});
testUsingContext
(
'flattenNameSubdirs'
,
()
{
expect
(
flattenNameSubdirs
(
Uri
.
parse
(
'http://flutter.io/foo/bar'
)),
'flutter.io/foo/bar'
);
expect
(
flattenNameSubdirs
(
Uri
.
parse
(
'http://docs.flutter.io/foo/bar'
)),
'docs.flutter.io/foo/bar'
);
expect
(
flattenNameSubdirs
(
Uri
.
parse
(
'https://www.flutter.io'
)),
'www.flutter.io'
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
new
MockFileSystem
(),
});
}
class
MockFileSystem
extends
MemoryFileSystem
{
...
...
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