File tree Expand file tree Collapse file tree 2 files changed +15
-19
lines changed
app/lib/tool/test_profile Expand file tree Collapse file tree 2 files changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -183,28 +183,22 @@ class ArchiveBuilder {
183183 final _entries = < TarEntry > [];
184184
185185 void addFile (String path, String content) {
186- final bytes = utf8.encode (content);
187- _entries.add (
188- TarEntry (
189- TarHeader (
190- name: path,
191- size: bytes.length,
192- mode: 420 , // 644₈
193- ),
194- Stream <List <int >>.fromIterable ([bytes]),
195- ),
196- );
186+ addFileBytes (path, utf8.encode (content));
197187 }
198188
199189 void addFileBytes (String path, List <int > bytes) {
190+ addFileByteChunks (path, [bytes]);
191+ }
192+
193+ void addFileByteChunks (String path, List <List <int >> chunks) {
200194 _entries.add (
201195 TarEntry (
202196 TarHeader (
203197 name: path,
204- size: bytes. length,
198+ size: chunks. fold < int >( 0 , (a, b) => a + b. length) ,
205199 mode: 420 , // 644₈
206200 ),
207- Stream <List <int >>.fromIterable ([bytes] ),
201+ Stream <List <int >>.fromIterable (chunks ),
208202 ),
209203 );
210204 }
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import '../../fake/backend/fake_auth_provider.dart';
1818import '../../frontend/handlers/pubapi.client.dart' ;
1919import '../../service/async_queue/async_queue.dart' ;
2020import '../../shared/configuration.dart' ;
21- import '../../shared/utils.dart' ;
2221import '../utils/pub_api_client.dart' ;
2322import 'import_source.dart' ;
2423import 'models.dart' ;
@@ -294,14 +293,17 @@ Future<List<int>> _mayCleanupTarModeBits(List<int> bytes) async {
294293 var needsUpdate = false ;
295294 while (await tarReader.moveNext ()) {
296295 final current = tarReader.current;
297- if (current.header.mode != 420 ) {
296+ if (current.header.mode & 420 != 420 ) {
298297 // 644₈
299298 needsUpdate = true ;
300299 }
301- archiveBuilder.addFileBytes (
302- current.name,
303- await current.contents.foldBytes (),
304- );
300+ if (current.header.typeFlag == TypeFlag .reg ||
301+ current.header.typeFlag == TypeFlag .regA) {
302+ archiveBuilder.addFileByteChunks (
303+ current.name,
304+ await current.contents.toList (),
305+ );
306+ }
305307 }
306308 return needsUpdate ? archiveBuilder.toTarGzBytes () : bytes;
307309}
You can’t perform that action at this time.
0 commit comments