@@ -124,7 +124,9 @@ public class FileSimilarityService {
|
||||
List<Long> userIds = new ArrayList<>();
|
||||
|
||||
if (company != null) {
|
||||
userIds.addAll(company.getUsers().stream().map(User::getId).toList());
|
||||
userIds.addAll(company.getUsers().stream()
|
||||
.map(User::getId)
|
||||
.toList());
|
||||
} else {
|
||||
userIds.add(userId);
|
||||
}
|
||||
@@ -132,16 +134,10 @@ public class FileSimilarityService {
|
||||
List<FileEntity> fileEntityList = fileEntityRepository.findByMimeTypeAndUserIds(mimeType, userIds);
|
||||
|
||||
for (FileEntity file : fileEntityList) {
|
||||
// if (file.getProtectedFilePath() == null) continue;
|
||||
// File existingFile = cloudStorageService.readFileFromStorageByPath(file.getFilePath());
|
||||
// File newFile = new File(path);
|
||||
|
||||
// if (existingFile.length() == newFile.length()) {
|
||||
if (!file.getStatus().name().equals(FileStatus.TEMP.name()) &&
|
||||
calculateFileHash(file.getFilePath(), true).equals(hash)) {
|
||||
return file;
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -217,6 +213,7 @@ public class FileSimilarityService {
|
||||
}
|
||||
|
||||
byte[] hashBytes = digest.digest();
|
||||
|
||||
return Base64.getEncoder().encodeToString(hashBytes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user