Zip downloads for git repos are corrupted

Issue #35 resolved
Michael DePalatis created an issue

When attempting to download zip files for git repositories, the resulting download cannot be opened. I get this error message from file-roller (Gnome's archive manager program):

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.utf8,Utf16=on,HugeFiles=on,8 CPUs)

Error: /tmp/ Can not open file as archive

Errors: 1

I have also confirmed with a colleague that files are not openable on Windows, either.

This issue only affects git repositories. Hg zip downloads work as expected.

Comments (5)

  1. Stefan Walter

    I can confirm this - I cannot unzip a downloaded ZIP file for a Git repository, either. On a Linux system, unzip says:

      End-of-central-directory signature not found.  Either this file is not
      a zipfile, or it constitutes one disk of a multi-part archive.  In the
      latter case the central directory and zipfile comment will be found on
      the last disk(s) of this archive.
    unzip:  cannot find zipfile directory in one of or
  , and cannot find, period.

    I noticed that, suspiciously, the size of the ZIP file was 20480 bytes and did not change after I pushed a change into the repository and re-downloaded the ZIP file. Probably the file is simply truncated.

  2. Matt Fellows

    The fix for this is fairly trivial: edit <kalithea_home>/kalithea/controllers/ on approximately line 571 you should see:

                               cs.fill_archive(stream=temp_stream, kind=fileformat, subrepos=subrepos)
                               if not subrepos and archive_cache_enabled:

    change this to:

                               cs.fill_archive(stream=temp_stream, kind=fileformat, subrepos=subrepos)
                               if not subrepos and archive_cache_enabled:

    And all your problems go away...

  3. Matt Fellows

    Also you will want to delete teh cached files in <kalithea_home>/cachedtarballs after applying this fix to ensure you download the fixed zip, not the cached broken zip

  4. Log in to comment