Skip to content

Empty files (zero byte files) cannot be copied via Nextcloud web interface: // Sabre\DAV\Exception: Error while copying file to target location (copied bytes: 0, expected filesize: -1 ) #16989

@herrep

Description

@herrep

The bug relates to Nextcloud server accessed via the Nextcloud web interface.
Copying empty files (zero bytes) causes an exception and the file is not copied or moved.

Sabre\DAV\Exception: Error while copying file to target location (copied bytes: 0, expected filesize: -1 )

Steps to reproduce

  1. Open Nextcloud web interface
  2. Select an empty file, i.e. a file with size of zero bytes or select a folder in which such a file is located
  3. Copy the selection to another place
  4. Wait for " could not be copied"

Expected behaviour

Even files with a size of zero bytes should be copied.

Actual behaviour

As soon as the file or folder selection marked for copy contains one or more zero byte files (empty files), the copy process stops as soon as the empty file is processed. This behaviour does not occur when having the empty files on a client and using a Nextcloud client for synchronizing the files. In this case, even zero byte files are properly synchronized with the server. The problem is limited to the case where the copy operation is invoked via the web interface. However, moving an empty file via the Nextcloud web interface works. It is only the copy that causes problems.

Server configuration

Nextcloud version: 16.0.4
Operating system and version: Ubuntu 18.04.3
Apache or nginx version: Apache/2.4.29 (Ubuntu)
PHP version: PHP 7.2.19-0ubuntu0.18.04.2

The output of your Nextcloud log in Admin > Logging:

Fatal	webdav	Sabre\DAV\Exception: Error while copying file to target location (copied bytes: 0, expected filesize: -1 )

{"reqId":"8AFy1iaAcUI95PDmI1SZ","level":3,"time":"2019-09-02T11:17:56+00:00","remoteAddr":"<ipaddress-proxyserver>","user":"<nextcloud-user>","app":"no app in context","method":"COPY","url":"/remote.php/dav/files/<nextcloud-user>/<large-folder-to-copy>","message":{"Exception":"Sabre\\DAV\\Exception","Message":"Error while copying file to target location (copied bytes: 0, expected filesize: -1 )","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":316,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["28 Urlaubstage pro Jahr.txt",null]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":326,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->","args":[{"__class__":"OCA\\DAV\\Connector\\Sabre\\File"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"}]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":326,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->","args":[{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"}]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":326,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->","args":[{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"}]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":130,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->","args":[{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"},"<large-folder-to-copy>"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":684,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->","args":["files/<nextcloud-user>/<large-folder-to-copy>","files/<nextcloud-user>/<nextcloud-user>/Archiv/<large-folder-to-copy>"]},{"function":"httpCopy","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"http://<hostaddress-proxyserver>/remote.php/dav/files/<nextcloud-user>/<large-folder-to-copy>","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpCopy"],[{"absoluteUrl":"http://<hostaddress-proxyserver>/remote.php/dav/files/<nextcloud-user>/<large-folder-to-copy>","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:COPY",[{"absoluteUrl":"http://<hostaddress-proxyserver>/remote.php/dav/files/<nextcloud-user>/<large-folder-to-copy>","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"http://<hostaddress-proxyserver>/remote.php/dav/files/<nextcloud-user>/<large-folder-to-copy>","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":316,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/nextcloud/remote.php","line":163,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":218,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Firefox/68.0","version":"16.0.4.1","id":"5d6cfa64b1588"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '<hidden>',
  'passwordsalt' => '<hidden>',
  'secret' => '<hidden>',
  'trusted_domains' => 
  array (
    0 => '<hidden>',
    1 => '<hidden>',
    2 => '<hidden>',
    3 => '<hidden>',
    4 => '<hidden>',
  ),
  'trusted_proxies' => 
  array (
    0 => '<hidden>',
  ),
  'datadirectory' => '<hidden>',
  'dbtype' => 'mysql',
  'version' => '16.0.4.1',
  'overwrite.cli.url' => '<hidden>',
  'overwriteprotocol' => 'https',
  'dbname' => '<hidden>',
  'dbhost' => '<hidden>',
  'dbport' => '<hidden>',
  'dbtableprefix' => '<hidden>',
  'dbuser' => '<hidden>',
  'dbpassword' => '<hidden>',
  'installed' => true,
  'mail_smtpmode' => 'sendmail',
  'mail_smtpsecure' => 'tls',
  'mail_from_address' => '<hidden>',
  'mail_domain' => '<hidden>',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => '<hidden>',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '<hidden>',
  'mail_smtppassword' => '<hidden>',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 0.0,
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Memcached',
  'memcached_servers' => 
  array (
    0 => 
    array (
      0 => 'localhost',
      1 => 11211,
    ),
  ),
  'maintenance' => false,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'theme' => '',
  'loglevel' => 2,
  'mysql.utf8mb4' => true,
  'data-fingerprint' => '<hidden>',
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
    1 => 'mail',
    2 => 'spreed',
    3 => 'bookmarks_fulltextsearch',
  ),
  'mail_sendmailmode' => 'pipe',
);

No output in Apache error log at /var/log/apache2/nextcloud_error.log

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions