From b4fbe4fd4430d644d60e8ffcb90370c75a84e540 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Mon, 24 Nov 2014 09:34:27 -0500
Subject: [PATCH] Ensure that pretty-printed files are served as text/plain in Raw servlet
---
src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java b/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java
index 517e80b..ae737a5 100644
--- a/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java
@@ -52,17 +52,23 @@
if (StringUtils.isEmpty(baseObjectId)) {
// use first parent
RevCommit parent = commit.getParentCount() == 0 ? null : commit.getParent(0);
- ImageDiffHandler handler = new ImageDiffHandler(getContextUrl(), repositoryName,
+ ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName,
parent.getName(), commit.getName(), imageExtensions);
diff = DiffUtils.getDiff(r, commit, blobPath, DiffOutputType.HTML, handler).content;
+ if (handler.getImgDiffCount() > 0) {
+ addBottomScript("scripts/imgdiff.js"); // Tiny support script for image diffs
+ }
add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
} else {
// base commit specified
RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);
- ImageDiffHandler handler = new ImageDiffHandler(getContextUrl(), repositoryName,
+ ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName,
baseCommit.getName(), commit.getName(), imageExtensions);
diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, DiffOutputType.HTML, handler).content;
+ if (handler.getImgDiffCount() > 0) {
+ addBottomScript("scripts/imgdiff.js"); // Tiny support script for image diffs
+ }
add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
WicketUtils.newBlobDiffParameter(repositoryName, baseObjectId, objectId,
blobPath)));
--
Gitblit v1.9.1