mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
Auto-redirect superfluous trailing slashes on presentaton URLs.
This commit is contained in:
parent
1a894737b3
commit
27366569f7
|
@ -109,11 +109,20 @@ public class PitchController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Catchall redirects any unhandled URLs to the GitPitch website.
|
* Catchall redirects any URL with a trailing slash to the
|
||||||
|
* URL minus the trailing slash. Any remaining unhandled URLs
|
||||||
|
* are redirected to the GitPitch website.
|
||||||
*/
|
*/
|
||||||
public Result catchall(String path) {
|
public Result catchall(String path) {
|
||||||
log.warn("catchall: redirecting from {}", path);
|
try {
|
||||||
return redirect("/");
|
if (path != "/" && path.endsWith("/")) {
|
||||||
|
return redirect("/" + path.substring(0, path.length()-1));
|
||||||
|
} else {
|
||||||
|
return redirect("/");
|
||||||
|
}
|
||||||
|
} catch(Exception ex) {
|
||||||
|
return redirect("/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user