Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download shared link as ZIP sends file with damaged header #8798

Closed
arnowelzel opened this issue Mar 13, 2018 · 13 comments
Closed

Download shared link as ZIP sends file with damaged header #8798

arnowelzel opened this issue Mar 13, 2018 · 13 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: files
Milestone

Comments

@arnowelzel
Copy link
Contributor

arnowelzel commented Mar 13, 2018

Steps to reproduce

  1. Create a folder and put some files into it
  2. Share this folder as a link to download
  3. Open the link in a browser (not macOS) and download the folder as a ZIP archive
  4. Extract the archive using 7-Zip and the Explorer context menu to extract files to a new folder

Expected behaviour

The ZIP archive can be downloaded and extracted on the client.

Actual behaviour

7-Zip reports an error in the header:

7-Zip error report

Maybe this is also the reason why ZIP is not used for macOS - not because of a bug in macOS but some problem in the created ZIP file.

Server configuration

Operating system:
Ubuntu 16.04

Web server:
Apache 2.4

Database:
MariaDB

PHP version:
7.0

Nextcloud version: (see Nextcloud admin page)
13.0.0

Updated from an older Nextcloud/ownCloud or fresh install:
Update from 12.0.5

Where did you install Nextcloud from:
nextcloud.com

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
Enabled:
  - activity: 2.6.1
  - apporder: 0.4.1
  - bookmarks: 0.11.0
  - bruteforcesettings: 1.0.3
  - calendar: 1.6.1
  - caniupdate: 0.1.2
  - comments: 1.3.0
  - contacts: 2.1.2
  - dav: 1.4.6
  - deck: 0.3.1
  - defaultlinkopen: 1.0.0
  - drawio: 0.8.9
  - external: 3.0.2
  - federatedfilesharing: 1.3.1
  - federation: 1.3.0
  - files: 1.8.0
  - files_markdown: 2.0.4
  - files_pdfviewer: 1.2.0
  - files_sharing: 1.5.0
  - files_texteditor: 2.5.1
  - files_trashbin: 1.3.0
  - files_versions: 1.6.0
  - files_videoplayer: 1.2.0
  - firstrunwizard: 2.2.1
  - gallery: 18.0.0
  - gpxmotion: 0.0.6
  - groupfolders: 1.2.0
  - logreader: 2.0.0
  - lookup_server_connector: 1.1.0
  - mail: 0.7.10
  - nextcloud_announcements: 1.2.0
  - notifications: 2.1.2
  - oauth2: 1.1.0
  - password_policy: 1.3.0
  - provisioning_api: 1.3.0
  - richdocuments: 2.0.3
  - serverinfo: 1.3.0
  - sharebymail: 1.3.0
  - socialsharing_email: 1.0.3
  - spreed: 3.1.0
  - survey_client: 1.1.0
  - systemtags: 1.3.0
  - tasks: 0.9.6
  - theming: 1.4.1
  - theming_customcss: 1.0.0
  - twofactor_backupcodes: 1.2.3
  - updatenotification: 1.3.0
  - workflowengine: 1.3.0
Disabled:
  - admin_audit
  - encryption
  - files_external
  - onlyoffice
  - user_external
  - user_ldap

Nextcloud configuration:

Config report
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "nextcloud.0x0c.de"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/nextcloud.0x0c.de",
        "dbtype": "mysql",
        "version": "13.0.0.14",
        "installed": true,
        "htaccess.RewriteBase": "\/",
        "maintenance": false,
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "knowledgebaseenabled": false,
        "theme": "",
        "loglevel": 2,
        "mysql.utf8mb4": false
    }
}

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox 58.0.2

Operating system: Windows 10 Pro x64

@MorrisJobke
Copy link
Member

cc @danxuliu @rullzer

@MorrisJobke MorrisJobke added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: files labels Mar 13, 2018
@Zefling
Copy link

Zefling commented Mar 17, 2018

For me, it's always this that works.
$this->streamerInstance = new ZipStreamer(['zip64' => false]);
in lib/private/Streamer.php

@AntoineMazuyer
Copy link

Even with this fix on Streamer.php, I still have the problem

@danxuliu
Copy link
Member

This should have been fixed in #7972, which will be included in Nextcloud 14. If you could verify if the issue is fixed for you in current master branch (do not forget to update too the 3rdparty repository) it would be great :-) Thanks!

@MorrisJobke
Copy link
Member

This should have been fixed in #7972, which will be included in Nextcloud 14. If you could verify if the issue is fixed for you in current master branch (do not forget to update too the 3rdparty repository) it would be great :-) Thanks!

Let's close it then. ;)

@alogoc
Copy link

alogoc commented May 3, 2019

Issue is still there on Nextcloud 15.0.7

@alogoc
Copy link

alogoc commented May 11, 2019

#15367 @danxuliu

@mkdsn
Copy link

mkdsn commented Sep 2, 2019

Issue is still there on Nextcloud 16.0.4

@arnowelzel
Copy link
Contributor Author

@mikeschdesign I can't reproduce this problem in 16.0.4 if the total size of the compressed files is less than 4 GiB (tested with 7-Zip 18.01 x64 in Windows 10 1903). ZipStreamer is now also used without 64 bit mode, if 64 bit is not needed, see lib/private/Streamer.php:

		if ($size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) {
			$this->streamerInstance = new ZipStreamer(['zip64' => false]);
		} else if ($request->isUserAgent($this->preferTarFor)) {
			$this->streamerInstance = new TarStreamer();
		} else {
			$this->streamerInstance = new ZipStreamer(['zip64' => PHP_INT_SIZE !== 4]);
		}

So please check, if this happens always or only for big files. As far I understand the fix, the 64 bit mode is causing problems - so downloading smaller archives which contain less then 4 GiB of uncompressed data should not be a problem any longer.

@MaievJL
Copy link

MaievJL commented Nov 1, 2019

I just hit this issue as well. The archive is 1GB, selecting a few less files still gave me this error (700MB).

@AbelLykens
Copy link

I am hitting this issue, still, on doxc documents (zip files). Also <1MB.

What I then do is ssh to my nextcloud, get the file from data dir. Not ideal.

@arnowelzel
Copy link
Contributor Author

arnowelzel commented Apr 10, 2020

@AbelLykens For me this works without any problem with Nextcloud 18.0.3 and 7-Zip 19.00. And it makes no differnce if you download multiple docx files or some other file type since the result is always a ZIP file.

BTW: you can just download single files as well without using ZIP at all.

@AbelLykens
Copy link

Sorry for bumping this thread.

It appears it is an apache problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: files
Projects
None yet
Development

No branches or pull requests

9 participants