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

This commit is contained in:
2026-04-21 10:43:13 +07:00
parent ac7cc54b5e
commit c33ffe516a
2 changed files with 5 additions and 6 deletions
@@ -133,11 +133,11 @@ public class FileSimilarityService {
for (FileEntity file : fileEntityList) { for (FileEntity file : fileEntityList) {
if (file.getProtectedFilePath() == null) continue; if (file.getProtectedFilePath() == null) continue;
File existingFile = new File(file.getProtectedFilePath()); File existingFile = cloudStorageService.readFileFromStorageByPath(file.getFilePath());
File newFile = new File(path); File newFile = new File(path);
if (existingFile.length() == newFile.length()) { if (existingFile.length() == newFile.length()) {
if (calculateFileHash(file.getProtectedFilePath()).equals(hash)) { if (calculateFileHash(file.getFilePath()).equals(hash)) {
return file; return file;
} }
} }
@@ -201,9 +201,8 @@ public class FileSimilarityService {
private String calculateFileHash(String path) throws Exception { private String calculateFileHash(String path) throws Exception {
MessageDigest digest = MessageDigest.getInstance("SHA-256"); MessageDigest digest = MessageDigest.getInstance("SHA-256");
File file = cloudStorageService.readFileFromStorageByPath(path);
try (InputStream is = new FileInputStream(file)) { try (InputStream is = cloudStorageService.readFileFromStorage(path)) {
byte[] buffer = new byte[8192]; byte[] buffer = new byte[8192];
int read; int read;
while ((read = is.read(buffer)) > 0) { while ((read = is.read(buffer)) > 0) {
@@ -387,8 +387,8 @@ public class FileUploadServiceImpl implements FileUploadService {
if (session.getFileType().startsWith("image")) { if (session.getFileType().startsWith("image")) {
checkForDuplicatesSynchronously(finalFilePath); checkForDuplicatesSynchronously(finalFilePath);
} else if (session.getFileType().startsWith("audio") || session.getFileType().startsWith("document")) { } else if (session.getFileType().startsWith("audio") || session.getFileType().startsWith("document")) {
// fileSimilarityService.hasDuplicatesByHash(finalFilePath ,session.getFileType(), fileSimilarityService.hasDuplicatesByHash(finalFilePath ,session.getFileType(),
// session.getUserId()); session.getUserId());
File file = new File(finalFilePath); File file = new File(finalFilePath);
// File file = cloudStorageService.readFileFromStorageByPath(finalFilePath); // File file = cloudStorageService.readFileFromStorageByPath(finalFilePath);