dev test baseurl for test
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-04-21 19:09:27 +07:00
parent dfc9a22bc5
commit 6c3742913c
5 changed files with 110 additions and 27 deletions
@@ -202,13 +202,16 @@ public class FileSimilarityService {
private String calculateFileHash(String path, boolean cloud) throws Exception {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
File file = cloud ? cloudStorageService.readFileFromStorageByPath(path): new File(path);
try (InputStream is = new FileInputStream(file)) {
byte[] buffer = new byte[8192];
int read;
while ((read = is.read(buffer)) > 0) {
digest.update(buffer, 0, read);
if (cloud) {
byte[] data = cloudStorageService.readFileFromStorageBytes(path);
digest.update(data);
} else {
try (InputStream is = new FileInputStream(path)) {
byte[] buffer = new byte[8192];
int read;
while ((read = is.read(buffer)) > 0) {
digest.update(buffer, 0, read);
}
}
}