@@ -109,15 +109,15 @@ public class FileSimilarityService {
|
||||
}
|
||||
|
||||
public void hasDuplicatesByHash(String path, String mimeType, Long userId) throws Exception {
|
||||
FileEntity duplicateByHash = findDuplicateByHash(path, mimeType, userId);
|
||||
FileEntity duplicateByHash = findDuplicateByHash(path, mimeType, userId, false);
|
||||
if (duplicateByHash != null) {
|
||||
throw new DuplicateImageException("Duplicate", duplicateByHash.getId(),
|
||||
duplicateByHash.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
public FileEntity findDuplicateByHash(String path, String mimeType, Long userId) throws Exception {
|
||||
String hash = calculateFileHash(path, false);
|
||||
public FileEntity findDuplicateByHash(String path, String mimeType, Long userId, boolean cloud) throws Exception {
|
||||
String hash = calculateFileHash(path, cloud);
|
||||
|
||||
User user = userRepository.findById(userId).orElseThrow();
|
||||
Company company = user.getCompany();
|
||||
|
||||
Reference in New Issue
Block a user