Skip to content

Commit 828106e

Browse files
committed
code review. Fixes #1379.
1 parent 83a22f8 commit 828106e

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

springdoc-openapi-ui/src/main/java/org/springdoc/webmvc/ui/SwaggerUiHome.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030
import static org.springdoc.core.Constants.MVC_SERVLET_PATH;
3131
import static org.springdoc.core.Constants.SWAGGER_UI_PATH;
32-
import static org.springdoc.core.Constants.SWAGGER_UI_URL;
33-
import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;
3432
import static org.springframework.web.servlet.view.UrlBasedViewResolver.REDIRECT_URL_PREFIX;
3533

3634
/**
@@ -45,25 +43,13 @@ public class SwaggerUiHome {
4543
@Value(MVC_SERVLET_PATH)
4644
private String mvcServletPath;
4745

48-
49-
@GetMapping(value = {DEFAULT_PATH_SEPARATOR, ""})
46+
@GetMapping
5047
@Operation(hidden = true)
5148
public String index() {
5249
StringBuilder uiRootPath = new StringBuilder();
53-
5450
if (StringUtils.isNotBlank(mvcServletPath))
5551
uiRootPath.append(mvcServletPath);
5652

57-
if (swaggerUiPath.contains("/")) {
58-
uiRootPath.append(swaggerUiPath.substring(0, swaggerUiPath.lastIndexOf('/')));
59-
}
60-
61-
StringBuilder fullPath = new StringBuilder();
62-
63-
fullPath.append(REDIRECT_URL_PREFIX);
64-
fullPath.append(uiRootPath);
65-
fullPath.append(SWAGGER_UI_URL);
66-
67-
return fullPath.toString();
53+
return REDIRECT_URL_PREFIX + uiRootPath + swaggerUiPath;
6854
}
6955
}

springdoc-openapi-webflux-ui/src/main/java/org/springdoc/webflux/ui/SwaggerUiHome.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import org.springframework.web.util.UriComponentsBuilder;
3737

3838
import static org.springdoc.core.Constants.SWAGGER_UI_PATH;
39-
import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;
4039

4140
/**
4241
* Home redirection to swagger api documentation
@@ -71,7 +70,7 @@ public SwaggerUiHome(Optional<WebFluxProperties> optionalWebFluxProperties) {
7170
* @param response the response
7271
* @return the mono
7372
*/
74-
@GetMapping(DEFAULT_PATH_SEPARATOR)
73+
@GetMapping
7574
@Operation(hidden = true)
7675
public Mono<Void> index(ServerHttpResponse response) {
7776
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(this.basePath + swaggerUiPath);

0 commit comments

Comments
 (0)