@@ -13,6 +13,7 @@ import 'package:crypto/crypto.dart';
1313import 'package:gcloud/storage.dart' ;
1414import 'package:logging/logging.dart' ;
1515import 'package:pool/pool.dart' ;
16+ import 'package:pub_dev/shared/monitoring.dart' ;
1617import 'package:pub_dev/shared/utils.dart' ;
1718import '../../shared/storage.dart' ;
1819import '../../shared/versions.dart'
@@ -138,6 +139,10 @@ final class ExportedApi {
138139 );
139140 await Future .wait (topLevelprefixes.map ((entry) async {
140141 if (entry.isObject) {
142+ _log.pubNoticeShout (
143+ 'stray-file' ,
144+ 'Found stray top-level file "${entry .name }" in ExportedApi' ,
145+ );
141146 return ; // ignore top-level files
142147 }
143148
@@ -147,6 +152,10 @@ final class ExportedApi {
147152 }
148153
149154 if (! runtimeVersionPattern.hasMatch (topLevelPrefix)) {
155+ _log.pubNoticeShout (
156+ 'stray-file' ,
157+ 'Found stray top-level prefix "${entry .name }" in ExportedApi' ,
158+ );
150159 return ; // Don't GC non-runtimeVersions
151160 }
152161
@@ -227,6 +236,14 @@ final class ExportedPackage {
227236 final pfx = '/api/archives/$_package -' ;
228237 await _owner._listBucket (prefix: pfx, delimiter: '' , (item) async {
229238 assert (item.isObject);
239+ if (! item.name.endsWith ('.tar.gz' )) {
240+ _log.pubNoticeShout (
241+ 'stray-file' ,
242+ 'Found stray file "${item .name }" in ExportedApi'
243+ ' while garbage collecting for "$_package " (ignoring it!)' ,
244+ );
245+ return ;
246+ }
230247 final version = item.name.without (prefix: pfx, suffix: '.tar.gz' );
231248 if (allVersionNumbers.contains (version)) {
232249 return ;
0 commit comments