Skip to content

Commit

Permalink
#136 [hotfix] Url 디코딩 버그 해결
Browse files Browse the repository at this point in the history
#136 [hotfix] Url 디코딩 버그 해결
  • Loading branch information
sohyundoh authored Jan 16, 2024
2 parents 1a58ef1 + 37f01f6 commit 16e7a3d
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.mile.exception.message.ErrorMessage;
import com.mile.exception.model.BadRequestException;
import com.mile.resolver.post.PostIdPathVariable;
import com.mile.utils.SecureUrlUtil;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
Expand All @@ -25,17 +24,17 @@ public class CommentVariableResolver implements HandlerMethodArgumentResolver {

@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(PostIdPathVariable.class);
return parameter.hasParameterAnnotation(CommentIdPathVariable.class);
}

@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
final HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest();
final Map<String, String> pathVariables = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);

final String meetingId = pathVariables.get(COMMENT_PATH_VARIABLE);
final String id = pathVariables.get(COMMENT_PATH_VARIABLE);
try {
return secureUrlUtil.decodeUrl(meetingId);
return secureUrlUtil.decodeUrl(id);
} catch (NumberFormatException e) {
throw new BadRequestException(ErrorMessage.INVALID_URL_EXCEPTION);
}
Expand Down

0 comments on commit 16e7a3d

Please sign in to comment.