(sample-exporter) Add some limits on sizes and lengths

Tar files will reject entries with filenames over 100b, so we need a limit there.  Also added a maximum size limit to keep the file sizes reasonable.
This commit is contained in:
Viktor Lofgren 2024-01-25 11:51:53 +01:00
parent 0846606b12
commit 1b8b97b8ec

View File

@ -37,7 +37,14 @@ public class SampleDataExporter {
List<WorkLogEntry> entriesAll = new ArrayList<>(100_000);
for (var item : WorkLog.iterable(crawlerLogFile)) {
if (item.cnt() < 2) continue;
if (item.cnt() < 2) // this one's too small
continue;
if (item.cnt() > 5000) // this one's too big
continue;
if (item.relPath().length() > 90) // this one's too long
continue; // TAR file name limit is 100, but we add some extra for good measure
// this one's just right
entriesAll.add(item);
}