Skip to content

Commit 9d3342d

Browse files
authored
Merge pull request #268 from MJSEC-MJU/hotfix/first
fix: 파일이 있을 경우 hash 없을 경우 hash null 로 나오게 수정
2 parents 340b01a + f2ca4c4 commit 9d3342d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Back/src/main/java/com/mjsec/ctf/dto/ChallengeDto.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ public static class Simple {
5454
private String category;
5555
private boolean solved;
5656
private String club;
57+
private boolean hasFile;
5758

5859
public static Simple fromEntity(ChallengeEntity challenge, boolean solved) {
60+
boolean hasFile = (challenge.getFileUrl() != null && !challenge.getFileUrl().isBlank());
5961
return Simple.builder()
6062
.challengeId(challenge.getChallengeId())
6163
.title(challenge.getTitle())
@@ -65,6 +67,7 @@ public static Simple fromEntity(ChallengeEntity challenge, boolean solved) {
6567
.category(challenge.getCategory() != null ? challenge.getCategory().toString() : null)
6668
.solved(solved)
6769
.club(challenge.getClub())
70+
.hasFile(hasFile)
6871
.build();
6972
}
7073
}
@@ -84,8 +87,10 @@ public static class Detail {
8487
private int solvers;
8588
private String category;
8689
private String club;
90+
private boolean hasFile;
8791

8892
public static Detail fromEntity(ChallengeEntity challenge) {
93+
boolean hasFile = (challenge.getFileUrl() != null && !challenge.getFileUrl().isBlank());
8994
return Detail.builder()
9095
.challengeId(challenge.getChallengeId())
9196
.title(challenge.getTitle())
@@ -96,6 +101,7 @@ public static Detail fromEntity(ChallengeEntity challenge) {
96101
.solvers(challenge.getSolvers())
97102
.category(challenge.getCategory() != null ? challenge.getCategory().toString() : null)
98103
.club(challenge.getClub())
104+
.hasFile(hasFile)
99105
.build();
100106
}
101107
}

0 commit comments

Comments
 (0)