@@ -56,7 +56,7 @@ public interface ImageSimilarityRepository
|
||||
JOIN file_entities f
|
||||
ON f.id = h.file_id
|
||||
WHERE ref.file_id = :fileId AND f.user_id = :userId
|
||||
AND f.status = 'ACTIVE'
|
||||
AND (f.status = 'ACTIVE' OR f.status = 'MODERATION')
|
||||
""",
|
||||
nativeQuery = true)
|
||||
List<SimilarImageProjection> findCandidatesFromUserFiles(
|
||||
@@ -82,7 +82,7 @@ public interface ImageSimilarityRepository
|
||||
JOIN file_entities f
|
||||
ON f.id = h.file_id
|
||||
WHERE ref.file_id = :fileId AND f.user_id IN :userIds
|
||||
AND f.status = 'ACTIVE'
|
||||
AND (f.status = 'ACTIVE' OR f.status = 'MODERATION')
|
||||
""",
|
||||
nativeQuery = true)
|
||||
List<SimilarImageProjection> findCandidatesFromUserFiles(
|
||||
@@ -108,7 +108,7 @@ public interface ImageSimilarityRepository
|
||||
JOIN file_entities f ON f.id = h.file_id
|
||||
WHERE h.hash64_hi = :hash64Hi
|
||||
AND h.hash64_lo = :hash64Lo
|
||||
AND f.status = 'ACTIVE'
|
||||
AND (f.status = 'ACTIVE' OR f.status = 'MODERATION')
|
||||
""",
|
||||
nativeQuery = true)
|
||||
List<SimilarImageProjection> findExactDuplicates(
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.vrt.fileprotection.FileProtector;
|
||||
import com.vrt.fileprotection.NoCopyCheckResult;
|
||||
import com.vrt.fileprotection.audio.AudioCheckResult;
|
||||
import com.vrt.fileprotection.documents.DocumentCheckResult;
|
||||
import com.vrt.fileprotection.image.ImageCheckResult;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -403,6 +402,7 @@ public class FileUploadServiceImpl implements FileUploadService {
|
||||
|
||||
FileProtector.Type type = "document".equals(session.getFileType()) ?
|
||||
FileProtector.Type.DOC : FileProtector.Type.valueOf(session.getFileType().toUpperCase());
|
||||
|
||||
NoCopyCheckResult checkResult = noCopyFileService.checkFile(file, type);
|
||||
|
||||
switch (checkResult) {
|
||||
@@ -411,13 +411,11 @@ public class FileUploadServiceImpl implements FileUploadService {
|
||||
throw new DuplicateImageException("Duplicate", info.getId(),
|
||||
Long.valueOf(info.getOwnerId()));
|
||||
}
|
||||
|
||||
case AudioCheckResult.Success success -> {
|
||||
FileProtector.FileInfo info = success.getInfo();
|
||||
throw new DuplicateImageException("Duplicate", info.getId(),
|
||||
Long.valueOf(info.getOwnerId()));
|
||||
}
|
||||
|
||||
case DocumentCheckResult.Failed failed ->
|
||||
log.warn("Document check failed: {}", failed.getMessage());
|
||||
case AudioCheckResult.Failed failed ->
|
||||
@@ -580,8 +578,8 @@ public class FileUploadServiceImpl implements FileUploadService {
|
||||
Path path = Paths.get(filePath);
|
||||
Map<String, Long> hash = imageHashService.calculateHash(path);
|
||||
|
||||
List<SimilarImageProjection> duplicates = fileSimilarityService.findDuplicatedByHash(hash.get("hi"),
|
||||
hash.get("low"));
|
||||
List<SimilarImageProjection> duplicates = fileSimilarityService.findDuplicatedByHash(
|
||||
hash.get("hi"), hash.get("low"));
|
||||
|
||||
if (!duplicates.isEmpty()) {
|
||||
throw new DuplicateImageException("Duplicate", duplicates.getFirst().getId(),
|
||||
|
||||
Reference in New Issue
Block a user