Skip to content
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

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

rladmstn
Copy link
Contributor

@rladmstn rladmstn commented Nov 18, 2024

📌 Related Issue

close #189

🚀 Description

  • 정상적인 url 값이 아닐 경우 parts 크기가 3 미만으로 될 경우도 유효하지 않은 백준 링크로 예외던지도록 조건 추가했습니다.

📢 Review Point

📚Etc (선택)

@rladmstn rladmstn added the new-feature 기능 추가 label Nov 18, 2024
@rladmstn rladmstn requested review from s-hwan and sh0723 November 18, 2024 14:55
@rladmstn rladmstn self-assigned this Nov 18, 2024
@@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 왜 세글자인지 알 수 있나요??

Copy link
Contributor Author

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인건 체킹이 안돼서 거기서 오류난지라 그 부분을 추가한겁니다!

Copy link
Contributor

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 string의 길이에 대한 length가 아니고 /이걸 기준으로 쪼갠 string 배열의 길이를 체크하는거네요?!
알겠씀다!

Copy link
Contributor

@s-hwan s-hwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생이많으심니다

@s-hwan s-hwan merged commit 26d494b into develop Nov 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat : 문제 생성 시 예외 처리 추가
3 participants