diff --git a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala index e57fdaf..8ead408 100644 --- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala @@ -1223,34 +1223,37 @@ } if (treeWalk != null) { while (treeWalk.next()) { - val entryPath = - if (path.isEmpty) baseName + "/" + treeWalk.getPathString - else path.split("/").last + treeWalk.getPathString.substring(path.length) - val mode = treeWalk.getFileMode.getBits - JGitUtil.openFile(git, repository, commit.getTree, treeWalk.getPathString) { in => - val tempFile = File.createTempFile("gitbucket", ".archive") - val size = Using.resource(new FileOutputStream(tempFile)) { out => - IOUtils.copy( - EolStreamTypeUtil.wrapInputStream( - in, - EolStreamTypeUtil - .detectStreamType( - OperationType.CHECKOUT_OP, - git.getRepository.getConfig.get(WorkingTreeOptions.KEY), - treeWalk.getAttributes - ) - ), - out - ) - } + if (treeWalk.getFileMode != FileMode.GITLINK) { + val entryPath = + if (path.isEmpty) baseName + "/" + treeWalk.getPathString + else path.split("/").last + treeWalk.getPathString.substring(path.length) + val mode = treeWalk.getFileMode.getBits - val entry: ArchiveEntry = entryCreator(entryPath, size, date, mode) - archive.putArchiveEntry(entry) - Using.resource(new FileInputStream(tempFile)) { in => - IOUtils.copy(in, archive) + JGitUtil.openFile(git, repository, commit.getTree, treeWalk.getPathString) { in => + val tempFile = File.createTempFile("gitbucket", ".archive") + val size = Using.resource(new FileOutputStream(tempFile)) { out => + IOUtils.copy( + EolStreamTypeUtil.wrapInputStream( + in, + EolStreamTypeUtil + .detectStreamType( + OperationType.CHECKOUT_OP, + git.getRepository.getConfig.get(WorkingTreeOptions.KEY), + treeWalk.getAttributes + ) + ), + out + ) + } + + val entry: ArchiveEntry = entryCreator(entryPath, size, date, mode) + archive.putArchiveEntry(entry) + Using.resource(new FileInputStream(tempFile)) { in => + IOUtils.copy(in, archive) + } + archive.closeArchiveEntry() + tempFile.delete() } - archive.closeArchiveEntry() - tempFile.delete() } } }