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 { android {
compileSdk 32 compileSdk 33
defaultConfig { defaultConfig {
applicationId "asgardius.page.s3manager" applicationId "asgardius.page.s3manager"
minSdk 24 minSdk 24
targetSdk 33 targetSdk 33
versionCode 15 versionCode 16
versionName "0.1.13" versionName "0.1.14"
setProperty("archivesBaseName", "s3-manager-$versionName") setProperty("archivesBaseName", "s3-manager-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 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); orequest = new ListObjectsRequest().withBucketName(bucket).withPrefix(object).withMaxKeys(8000);
} }
ObjectListing result = s3client.listObjects(orequest); ObjectListing result = s3client.listObjects(orequest);
do { List<S3ObjectSummary> objects = result.getObjectSummaries();
for (S3ObjectSummary objectSummary : result.getObjectSummaries()) { boolean nextbatch = false;
totalSize += objectSummary.getSize(); while (result.isTruncated() || !nextbatch) {
if (nextbatch) {
result = s3client.listNextBatchOfObjects (result);
objects = result.getObjectSummaries();
} else {
nextbatch = true;
}
for (S3ObjectSummary os : objects) {
totalSize += os.getSize();
totalItems++; totalItems++;
} }
result = s3client.listNextBatchOfObjects (result);
} while (result.isTruncated());
}
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {