Skip to content

Commit

Permalink
fixed s3 move method
Browse files Browse the repository at this point in the history
  • Loading branch information
rsehr committed Aug 30, 2024
1 parent 1dfa1d7 commit 8d56e63
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/main/java/de/sub/goobi/helper/S3FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -766,17 +766,18 @@ public void move(Path oldPath, Path newPath) throws IOException {
// copy all files in prefix, delete old files
copyDirectory(oldPath, newPath);
deleteDir(oldPath);
}
} else {
// copy single file
Copy copy = transferManager.copy(getBucket(), path2Key(oldPath), getBucket(), path2Key(newPath));
try {
copy.waitForCompletion();
s3.deleteObject(getBucket(), path2Key(oldPath));
} catch (AmazonClientException e) {
throw new IOException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();

} else {
// copy single file
Copy copy = transferManager.copy(getBucket(), path2Key(oldPath), getBucket(), path2Key(newPath));
try {
copy.waitForCompletion();
s3.deleteObject(getBucket(), path2Key(oldPath));
} catch (AmazonClientException e) {
throw new IOException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
}
Expand Down

0 comments on commit 8d56e63

Please sign in to comment.