diff options
author | Jacek Centkowski <geminica.programs@gmail.com> | 2016-11-24 11:32:48 +0100 |
---|---|---|
committer | Jacek Centkowski <geminica.programs@gmail.com> | 2016-11-24 11:32:48 +0100 |
commit | 8f6029786144b1d96e48d789c187cd8138ce8256 (patch) | |
tree | d4340dda8478094c7d6bde18fcf208a29026f500 /org.eclipse.jgit.lfs.server/src/org/eclipse/jgit | |
parent | a66b4c29a824306b5c606a079b72d8b57335a76f (diff) | |
download | jgit-8f6029786144b1d96e48d789c187cd8138ce8256.tar.gz jgit-8f6029786144b1d96e48d789c187cd8138ce8256.zip |
Use the same variable to check and extract LFS object id
It is easier to maintain when the same variable is used for both check
and extraction of LFS object id.
Change-Id: I5406f9bc4a085aa164c4565a9667ad2925105190
Signed-off-by: Jacek Centkowski <geminica.programs@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server/src/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java index 39aaa91d04..2ecba6d029 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java @@ -128,13 +128,14 @@ public class FileLfsServlet extends HttpServlet { private AnyLongObjectId getObjectToTransfer(HttpServletRequest req, HttpServletResponse rsp) throws IOException { String info = req.getPathInfo(); - if (info.length() != 1 + Constants.LONG_OBJECT_ID_STRING_LENGTH) { + int length = 1 + Constants.LONG_OBJECT_ID_STRING_LENGTH; + if (info.length() != length) { sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, MessageFormat .format(LfsServerText.get().invalidPathInfo, info)); return null; } try { - return LongObjectId.fromString(info.substring(1, 65)); + return LongObjectId.fromString(info.substring(1, length)); } catch (InvalidLongObjectIdException e) { sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, e.getMessage()); return null; |