@@ -152,17 +152,17 @@ public class FileSimilarityService {
|
||||
return duplicates;
|
||||
}
|
||||
|
||||
public void hasDuplicatesByHash(String path, Long userId, String mimeType) throws Exception {
|
||||
String hash = calculateFileHash(path);
|
||||
List<FileEntity> fileEntityList = fileEntityRepository.findByUserIdAndMimeType(userId, mimeType);
|
||||
|
||||
for (FileEntity file : fileEntityList) {
|
||||
if (calculateFileHash(file.getFilePath()).equals(hash)) {
|
||||
throw new DuplicateImageException("Duplicate", file.getId(),
|
||||
file.getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// public void hasDuplicatesByHash(String path, Long userId, String mimeType) throws Exception {
|
||||
// String hash = calculateFileHash(path);
|
||||
// List<FileEntity> fileEntityList = fileEntityRepository.findByUserIdAndMimeType(userId, mimeType);
|
||||
//
|
||||
// for (FileEntity file : fileEntityList) {
|
||||
// if (calculateFileHash(file.getFilePath()).equals(hash)) {
|
||||
// throw new DuplicateImageException("Duplicate", file.getId(),
|
||||
// file.getUserId());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public Page<SimilarFileDTO> findSimilarFiles(String fileId, SimilarityFilter filter, Pageable pageable,
|
||||
// String authToken) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user