Browse Source

Merge branch 'stable-4.5'

* stable-4.5:
  Use the same variable to check and extract LFS object id

Change-Id: I314bd4373f40843c68853b3999f60d85e08628d9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.6
David Pursehouse 8 years ago
parent
commit
c62933bf59
  1. 5
      org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java

5
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, private AnyLongObjectId getObjectToTransfer(HttpServletRequest req,
HttpServletResponse rsp) throws IOException { HttpServletResponse rsp) throws IOException {
String info = req.getPathInfo(); 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 sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, MessageFormat
.format(LfsServerText.get().invalidPathInfo, info)); .format(LfsServerText.get().invalidPathInfo, info));
return null; return null;
} }
try { try {
return LongObjectId.fromString(info.substring(1, 65)); return LongObjectId.fromString(info.substring(1, length));
} catch (InvalidLongObjectIdException e) { } catch (InvalidLongObjectIdException e) {
sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, e.getMessage()); sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, e.getMessage());
return null; return null;

Loading…
Cancel
Save