mirror of https://github.com/halo-dev/halo
fix: permalink of singlePage cannot contain special characters (#3867)
#### What type of PR is this? /kind bug /area core /milestone 2.5.x #### What this PR does / why we need it: 修复页面的链接不能包含特殊字符的问题。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/3808 #### Special notes for your reviewer: 测试方式: 1. 创建一个页面。 2. 尝试设置别名为中文或者其他字符。 3. 尝试包含多个 `/` 分隔符。 4. 尝试访问页面,检查是否能够正常访问。 #### Does this PR introduce a user-facing change? ```release-note 修复页面链接包含中文等字符后无法访问的问题。 ```pull/3870/head
parent
d9f2f77bc2
commit
a0265d2e6b
|
@ -1,8 +1,6 @@
|
|||
package run.halo.app.theme.router;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
|
||||
import static org.springframework.web.util.UriUtils.encodePath;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -119,8 +117,7 @@ public class SinglePageRoute
|
|||
}
|
||||
|
||||
String singlePageRoute(String slug) {
|
||||
var permalink = encodePath(slug, UTF_8);
|
||||
return StringUtils.prependIfMissing(permalink, "/");
|
||||
return StringUtils.prependIfMissing(slug, "/");
|
||||
}
|
||||
|
||||
HandlerFunction<ServerResponse> handlerFunction(String name) {
|
||||
|
|
Loading…
Reference in New Issue