fix object listing

This commit is contained in:
Page Asgardius 2022-09-22 16:29:43 -07:00
parent c83f48ec3e
commit d7fa3668c1
2 changed files with 15 additions and 8 deletions

View file

@ -3,14 +3,14 @@ plugins {
}
android {
compileSdk 32
compileSdk 33
defaultConfig {
applicationId "asgardius.page.s3manager"
minSdk 24
targetSdk 33
versionCode 15
versionName "0.1.13"
versionCode 16
versionName "0.1.14"
setProperty("archivesBaseName", "s3-manager-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -91,14 +91,21 @@ public class ObjectInfo extends AppCompatActivity {
orequest = new ListObjectsRequest().withBucketName(bucket).withPrefix(object).withMaxKeys(8000);
}
ObjectListing result = s3client.listObjects(orequest);
do {
for (S3ObjectSummary objectSummary : result.getObjectSummaries()) {
totalSize += objectSummary.getSize();
List<S3ObjectSummary> objects = result.getObjectSummaries();
boolean nextbatch = false;
while (result.isTruncated() || !nextbatch) {
if (nextbatch) {
result = s3client.listNextBatchOfObjects (result);
objects = result.getObjectSummaries();
} else {
nextbatch = true;
}
for (S3ObjectSummary os : objects) {
totalSize += os.getSize();
totalItems++;
}
result = s3client.listNextBatchOfObjects (result);
} while (result.isTruncated());
}
runOnUiThread(new Runnable() {