summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-06-27 14:36:50 -0400
committerJames Moger <james.moger@gitblit.com>2014-06-27 14:36:50 -0400
commitadfbad2d9821c50eda6141dc482e0605fd15d4e0 (patch)
treee5c8db2c65fbe32ab0e7eb025e8d48eba76dc5be
parenta216b1358842ceca2b0c3008c28f2579d2931330 (diff)
downloadgitblit-adfbad2d9821c50eda6141dc482e0605fd15d4e0.tar.gz
gitblit-adfbad2d9821c50eda6141dc482e0605fd15d4e0.zip
Redirect to tree root when blob page parameters are invalid
-rw-r--r--src/main/java/com/gitblit/wicket/pages/BlobPage.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/BlobPage.java b/src/main/java/com/gitblit/wicket/pages/BlobPage.java
index f3d0bc92..0938fcde 100644
--- a/src/main/java/com/gitblit/wicket/pages/BlobPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/BlobPage.java
@@ -21,6 +21,7 @@ import java.util.Map;
import org.apache.wicket.Component;
import org.apache.wicket.PageParameters;
+import org.apache.wicket.RedirectException;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
@@ -52,6 +53,10 @@ public class BlobPage extends RepositoryPage {
final String blobPath = WicketUtils.getPath(params);
String [] encodings = getEncodings();
+ if (StringUtils.isEmpty(objectId) && StringUtils.isEmpty(blobPath)) {
+ throw new RedirectException(TreePage.class, WicketUtils.newRepositoryParameter(repositoryName));
+ }
+
if (StringUtils.isEmpty(blobPath)) {
// blob by objectid