From 45e7d914f3519882c63f60eafd9f746b2d56d967 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Fri, 10 Aug 2012 16:12:51 -0400 Subject: [PATCH] Encode as UTF-8 --- src/com/gitblit/utils/JGitUtils.java | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index 4415982..90e6a76 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -559,18 +559,20 @@ } ObjectId entid = tw.getObjectId(0); FileMode entmode = tw.getFileMode(0); - RevObject ro = rw.lookupAny(entid, entmode.getObjectType()); - rw.parseBody(ro); - ByteArrayOutputStream os = new ByteArrayOutputStream(); - ObjectLoader ldr = repository.open(ro.getId(), Constants.OBJ_BLOB); - byte[] tmp = new byte[4096]; - InputStream in = ldr.openStream(); - int n; - while ((n = in.read(tmp)) > 0) { - os.write(tmp, 0, n); + if (entmode != FileMode.GITLINK) { + RevObject ro = rw.lookupAny(entid, entmode.getObjectType()); + rw.parseBody(ro); + ByteArrayOutputStream os = new ByteArrayOutputStream(); + ObjectLoader ldr = repository.open(ro.getId(), Constants.OBJ_BLOB); + byte[] tmp = new byte[4096]; + InputStream in = ldr.openStream(); + int n; + while ((n = in.read(tmp)) > 0) { + os.write(tmp, 0, n); + } + in.close(); + content = os.toByteArray(); } - in.close(); - content = os.toByteArray(); } } catch (Throwable t) { error(t, repository, "{0} can't find {1} in tree {2}", path, tree.name()); -- Gitblit v1.9.1