Joburgess 5 년 전
부모
커밋
54c2b8c2a1
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ShortUrlController.java

+ 3 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ShortUrlController.java

@@ -10,8 +10,10 @@ import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.net.URLEncoder;
 import java.util.Objects;
 
 /**
@@ -32,7 +34,7 @@ public class ShortUrlController extends BaseController {
         if(Objects.isNull(shortUrl)|| StringUtils.isBlank(shortUrl.getUrl())){
             return;
         }
-        response.sendRedirect(shortUrl.getUrl());
+        response.sendRedirect(URLEncoder.encode(shortUrl.getUrl(), "GBK"));
     }
 
 }