Skip to content

Commit

Permalink
Merge pull request #210 from ITA-OneByte/dev
Browse files Browse the repository at this point in the history
[Release] 폴더 경로에 맞는 파일 조회
  • Loading branch information
dpfls0922 authored Jan 15, 2025
2 parents d42ea81 + efb7bbe commit 894166a
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public List<FileResponse> getFilesFromS3(Member member, DriveType driveType, Str
String folderPathWithSlash = folderPath.isEmpty() ? folderPath : folderPath + "/";
for (S3ObjectSummary summary : objectSummaries) {
FileResponse fileInfo = buildFileInfo(summary);
if (!fileInfo.fileName().equals(folderPathWithSlash)) {

boolean isNotFolderItself = !fileInfo.fileName().equals(folderPathWithSlash);
boolean isInTargetFolder = fileInfo.folderPath().equals(folderPathWithSlash);
if (isNotFolderItself && isInTargetFolder) {
files.add(fileInfo);
}
}
Expand All @@ -48,9 +51,10 @@ public List<FileResponse> searchFilesByName(Member member, DriveType driveType,
return result.getObjectSummaries().stream()
.map(this::buildFileInfo)
.filter(fileInfo -> {
boolean isFolder = fileInfo.fileName().equals(folderPathWithSlash);
boolean isNotFolderItself = !fileInfo.fileName().equals(folderPathWithSlash);
boolean matchesFileName = fileName.isEmpty() || normalize(fileInfo.fileName()).contains(normalize(fileName));
return !isFolder && matchesFileName;
boolean isInTargetFolder = fileInfo.folderPath().equals(folderPathWithSlash);
return isNotFolderItself && matchesFileName && isInTargetFolder;
})
.collect(Collectors.toList());
}
Expand Down Expand Up @@ -99,11 +103,11 @@ public List<FileResponse> classifyFilesByType(Member member, DriveType driveType
return result.getObjectSummaries().stream()
.map(this::buildFileInfo)
.filter(fileInfo -> {
boolean isFolder = fileInfo.fileName().equals(folderPathWithSlash);
boolean isNotFolderItself = !fileInfo.fileName().equals(folderPathWithSlash);
boolean matchesFileType = DriveUtil.getFileType(fileInfo.fileName()).equals(filterFileType);
return !isFolder && matchesFileType;
boolean isInTargetFolder = fileInfo.folderPath().equals(folderPathWithSlash);
return isNotFolderItself && matchesFileType && isInTargetFolder;
})
.collect(Collectors.toList());
}

}

0 comments on commit 894166a

Please sign in to comment.