diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2016-08-13 16:56:20 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2016-08-16 11:01:20 +0900 |
commit | 0b4751e805e3792403c5e3b39aa4f5555081991d (patch) | |
tree | 88b33f4c4f5109ad3ab47fd27cfcb00bfd6fe082 | |
parent | 59b96549a6518876e49bb5dbf1aa2b63e3f759c7 (diff) | |
download | jgit-0b4751e805e3792403c5e3b39aa4f5555081991d.tar.gz jgit-0b4751e805e3792403c5e3b39aa4f5555081991d.zip |
LfsProtocolServlet: Always set the Content-Type header on response
If the Content-Type is not set on error responses, the git-lfs client
does not read the body which contains the error message, and instead
just displays a generic error message.
Also set the charset on the Content-Type header.
Change-Id: I88e6f07f20b622a670e7c5063145dffb8b630aee
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
-rw-r--r-- | org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java index 984e4a962d..bfd551d58a 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java @@ -83,7 +83,8 @@ public abstract class LfsProtocolServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private static final String CONTENTTYPE_VND_GIT_LFS_JSON = "application/vnd.git-lfs+json"; //$NON-NLS-1$ + private static final String CONTENTTYPE_VND_GIT_LFS_JSON = + "application/vnd.git-lfs+json; charset=utf-8"; //$NON-NLS-1$ private Gson gson = createGson(); @@ -143,6 +144,7 @@ public abstract class LfsProtocolServlet extends HttpServlet { LfsRequest request = gson.fromJson(r, LfsRequest.class); String path = req.getPathInfo(); + res.setContentType(CONTENTTYPE_VND_GIT_LFS_JSON); LargeFileRepository repo = null; try { repo = getLargeFileRepository(request, path); @@ -150,7 +152,6 @@ public abstract class LfsProtocolServlet extends HttpServlet { res.setStatus(SC_SERVICE_UNAVAILABLE); } else { res.setStatus(SC_OK); - res.setContentType(CONTENTTYPE_VND_GIT_LFS_JSON); TransferHandler handler = TransferHandler .forOperation(request.operation, repo, request.objects); gson.toJson(handler.process(), w); |