From 8c8f1f537b62a608e9ef01b70bec5a8df4dc8e8a Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Wed, 16 Jan 2013 07:57:18 -0500 Subject: [PATCH] Escape metacharacters for settings updates --- src/com/gitblit/wicket/pages/CommitPage.java | 31 +++++++++++++++++-------------- 1 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/com/gitblit/wicket/pages/CommitPage.java b/src/com/gitblit/wicket/pages/CommitPage.java index 7bc6b41..c5a24c8 100644 --- a/src/com/gitblit/wicket/pages/CommitPage.java +++ b/src/com/gitblit/wicket/pages/CommitPage.java @@ -32,16 +32,15 @@ import org.eclipse.jgit.revwalk.RevCommit; import com.gitblit.Constants; -import com.gitblit.DownloadZipServlet; import com.gitblit.GitBlit; -import com.gitblit.Keys; import com.gitblit.models.GitNote; -import com.gitblit.models.SubmoduleModel; import com.gitblit.models.PathModel.PathChangeModel; +import com.gitblit.models.SubmoduleModel; import com.gitblit.utils.JGitUtils; import com.gitblit.wicket.WicketUtils; import com.gitblit.wicket.panels.CommitHeaderPanel; import com.gitblit.wicket.panels.CommitLegendPanel; +import com.gitblit.wicket.panels.CompressedDownloadsPanel; import com.gitblit.wicket.panels.GravatarImage; import com.gitblit.wicket.panels.LinkPanel; import com.gitblit.wicket.panels.RefsPanel; @@ -95,8 +94,8 @@ newCommitParameter())); add(new BookmarkablePageLink<Void>("treeLink", TreePage.class, newCommitParameter())); final String baseUrl = WicketUtils.getGitblitURL(getRequest()); - add(new ExternalLink("zipLink", DownloadZipServlet.asLink(baseUrl, repositoryName, - objectId, null)).setVisible(GitBlit.getBoolean(Keys.web.allowZipDownloads, true))); + + add(new CompressedDownloadsPanel("compressedLinks", baseUrl, repositoryName, objectId, null)); // Parent Commits ListDataProvider<String> parentsDp = new ListDataProvider<String>(parents); @@ -171,25 +170,29 @@ WicketUtils.newPathParameter(submodulePath, submoduleId, "")).setEnabled(hasSubmodule)); } else { // blob - item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, + String displayPath = entry.path; + String path = entry.path; + if (entry.isSymlink()) { + path = JGitUtils.getStringContent(getRepository(), getCommit().getTree(), path); + displayPath = entry.path + " -> " + path; + } + item.add(new LinkPanel("pathName", "list", displayPath, BlobPage.class, WicketUtils - .newPathParameter(repositoryName, entry.commitId, entry.path))); + .newPathParameter(repositoryName, entry.commitId, path))); } // quick links if (entry.isSubmodule()) { // submodule item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)) - .setEnabled(false)); + .newPathParameter(repositoryName, entry.commitId, entry.path)) + .setEnabled(!entry.changeType.equals(ChangeType.ADD))); item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule)); - item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)) - .setEnabled(false)); + item.add(new ExternalLink("blame", "").setEnabled(false)); item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)) - .setEnabled(hasSubmodule)); + .newPathParameter(repositoryName, entry.commitId, entry.path)) + .setEnabled(!entry.changeType.equals(ChangeType.ADD))); } else { // tree or blob item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, WicketUtils -- Gitblit v1.9.1