mirror of https://github.com/halo-dev/halo
Merge branch 'master' of github.com:halo-dev/halo into fix-backup-function
commit
e0c12a23ee
|
@ -236,8 +236,7 @@ public class WebMvcAutoConfiguration extends WebMvcConfigurationSupport {
|
|||
|
||||
private void initBlackPatterns() {
|
||||
String uploadUrlPattern = ensureBoth(haloProperties.getUploadUrlPrefix(), URL_SEPARATOR) + "**";
|
||||
String adminPathPattern = ensureBoth(haloProperties.getAdminPath(), URL_SEPARATOR) + "**";
|
||||
|
||||
String adminPathPattern = ensureBoth(haloProperties.getAdminPath(), URL_SEPARATOR) + "?*/**";
|
||||
|
||||
blackPatterns.add("/themes/**");
|
||||
blackPatterns.add("/js/**");
|
||||
|
|
|
@ -11,6 +11,7 @@ import run.halo.app.model.properties.BlogProperties;
|
|||
import run.halo.app.model.support.HaloConst;
|
||||
import run.halo.app.service.OptionService;
|
||||
import run.halo.app.service.UserService;
|
||||
import run.halo.app.utils.HaloUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
@ -48,7 +49,7 @@ public class MainController {
|
|||
|
||||
@GetMapping("${halo.admin-path:admin}")
|
||||
public void admin(HttpServletResponse response) throws IOException {
|
||||
String adminIndexRedirectUri = StringUtils.appendIfMissing(this.haloProperties.getAdminPath(), "/") + INDEX_REDIRECT_URI;
|
||||
String adminIndexRedirectUri = HaloUtils.ensureBoth(haloProperties.getAdminPath(), HaloUtils.URL_SEPARATOR) + INDEX_REDIRECT_URI;
|
||||
response.sendRedirect(adminIndexRedirectUri);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package run.halo.app.conf;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
/**
|
||||
* Ant path matcher test.
|
||||
*
|
||||
* @author johnniang
|
||||
*/
|
||||
public class AntPathMatcherTest {
|
||||
|
||||
private final AntPathMatcher pathMatcher = new AntPathMatcher();
|
||||
|
||||
@Test
|
||||
public void matchTest() {
|
||||
Assert.assertFalse(pathMatcher.match("/admin/?*/**", "/admin"));
|
||||
Assert.assertFalse(pathMatcher.match("/admin/?*/**", "/admin/"));
|
||||
|
||||
Assert.assertTrue(pathMatcher.match("/admin/?*/**", "/admin/index.html"));
|
||||
Assert.assertTrue(pathMatcher.match("/admin/?*/**", "/admin/index.html/more"));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue