-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat : 문제 생성 시 잘못된 링크 예외 조건 추가 #190
Conversation
@@ -337,7 +337,7 @@ private String getProblemTitle(JsonNode problemDetails) { | |||
private String getProblemId(CreateProblemRequest request) { | |||
String url = request.link(); | |||
String[] parts = url.split("/"); | |||
if (!parts[2].equals("www.acmicpc.net")) | |||
if (parts.length < 3 || !parts[2].equals(BOJ_PROBLEM_URL)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 왜 세글자인지 알 수 있나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parts[2]
를 접근해야 그 위치부터 백준 URL 검증이 되나봐요! 기존 코드에서 parts[2]
를 접근하고 있는데 길이가 3인건 체킹이 안돼서 거기서 오류난지라 그 부분을 추가한겁니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 string의 길이에 대한 length가 아니고 /이걸 기준으로 쪼갠 string 배열의 길이를 체크하는거네요?!
알겠씀다!
@@ -337,7 +337,7 @@ private String getProblemTitle(JsonNode problemDetails) { | |||
private String getProblemId(CreateProblemRequest request) { | |||
String url = request.link(); | |||
String[] parts = url.split("/"); | |||
if (!parts[2].equals("www.acmicpc.net")) | |||
if (parts.length < 3 || !parts[2].equals(BOJ_PROBLEM_URL)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 string의 길이에 대한 length가 아니고 /이걸 기준으로 쪼갠 string 배열의 길이를 체크하는거네요?!
알겠씀다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생이많으심니다
📌 Related Issue
close #189
🚀 Description
parts
크기가 3 미만으로 될 경우도 유효하지 않은 백준 링크로 예외던지도록 조건 추가했습니다.📢 Review Point
📚Etc (선택)