Community
Participate
Working Groups
The class org.eclipse.jgit.lfs.SmudgeFilter uses the function org.eclipse.jgit.lfs.internal.LfsConnectionFactory#getLfsContentConnection to create the http request to read the lfs content. In this method, at the end the accepted encoding is set to 'gzip' (https://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java?h=v6.2.0.202206011217-rc1#n234). But if the server responds with a compressed stream, this is not decompressed by the SmudgeFilter. Therefore, the SmudgeFilter will read insufficient bytes and fails here with an IOException: https://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java?h=v6.2.0.202206011217-rc1#n206 To solve this, either the connection factory should not set the accept header, or the smudge filter should inspect the content encoding header with something like this and process the resulting stream: private static InputStream getInputStream(HttpConnection contentServerConn, InputStream contentIn) throws IOException { if (ENCODING_GZIP.equals(contentServerConn.getHeaderField(HDR_CONTENT_ENCODING))) { return new GZIPInputStream(contentIn); } return contentIn; }
Sounds good. Can you push the fix to Gerrit? See [1] for info on contributing. [1] https://wiki.eclipse.org/EGit/Contributor_Guide#Contributing_Patches