{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/17594","labels_url":"https://api.github.com/repos/owncloud/core/issues/17594/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/17594/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/17594/events","html_url":"https://github.com/owncloud/core/issues/17594","id":94604690,"number":17594,"title":"[8.1] Incorrect filesize uploading files via Webdav as recipient using encryption","user":{"login":"xn--nding-jua","id":9845353,"avatar_url":"https://avatars.githubusercontent.com/u/9845353?v=3","gravatar_id":"","url":"https://api.github.com/users/xn--nding-jua","html_url":"https://github.com/xn--nding-jua","followers_url":"https://api.github.com/users/xn--nding-jua/followers","following_url":"https://api.github.com/users/xn--nding-jua/following{/other_user}","gists_url":"https://api.github.com/users/xn--nding-jua/gists{/gist_id}","starred_url":"https://api.github.com/users/xn--nding-jua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xn--nding-jua/subscriptions","organizations_url":"https://api.github.com/users/xn--nding-jua/orgs","repos_url":"https://api.github.com/users/xn--nding-jua/repos","events_url":"https://api.github.com/users/xn--nding-jua/events{/privacy}","received_events_url":"https://api.github.com/users/xn--nding-jua/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/core/labels/app:encryption","name":"app:encryption","color":"02d7e1"},{"url":"https://api.github.com/repos/owncloud/core/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/owncloud/core/labels/regression","name":"regression","color":"e11d21"},{"url":"https://api.github.com/repos/owncloud/core/labels/sev1-critical","name":"sev1-critical","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/46","html_url":"https://github.com/owncloud/core/milestones/8.1.1-current-maintenance","labels_url":"https://api.github.com/repos/owncloud/core/milestones/46/labels","id":1167392,"number":46,"title":"8.1.1-current-maintenance","description":"","creator":{"login":"cmonteroluque","id":879976,"avatar_url":"https://avatars.githubusercontent.com/u/879976?v=3","gravatar_id":"","url":"https://api.github.com/users/cmonteroluque","html_url":"https://github.com/cmonteroluque","followers_url":"https://api.github.com/users/cmonteroluque/followers","following_url":"https://api.github.com/users/cmonteroluque/following{/other_user}","gists_url":"https://api.github.com/users/cmonteroluque/gists{/gist_id}","starred_url":"https://api.github.com/users/cmonteroluque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmonteroluque/subscriptions","organizations_url":"https://api.github.com/users/cmonteroluque/orgs","repos_url":"https://api.github.com/users/cmonteroluque/repos","events_url":"https://api.github.com/users/cmonteroluque/events{/privacy}","received_events_url":"https://api.github.com/users/cmonteroluque/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":69,"state":"open","created_at":"2015-06-16T19:39:31Z","updated_at":"2015-07-31T13:03:00Z","due_on":"2015-08-04T04:00:00Z","closed_at":null},"comments":59,"created_at":"2015-07-12T22:19:38Z","updated_at":"2015-07-31T13:42:35Z","closed_at":null,"body":"### Steps to reproduce\r\n1. Upload a file using webdav (e.g. FileSync on Android) - here a 1.4 MB file - using the mode \"use temporary files\"\r\n2. The uploaded file will be encrypted, put into the ownCloud filesystem and the filesize within the oc_filecache-database is set to the size of the encrypted file (1.9 MB). The flag \"encrypted\" will be not set within oc_filecache\r\n3. Using the web-interface the JPG-file can be displayed (1.4MB) and downloaded (1.4MB) but the ownCloud-Windows-Client aborts with errors and the file cannot be downloaded using a browser and the direct webdav-link (the browser tries to download 1.9MB and aborts after 1.4MB)\r\n\r\n### Expected behaviour\r\nThe filesize should be published to the webdav-clients correctly. The decrypted filesize has to be stored within oc_filecache and the flag \"encrypted\" has to be set to 1.\r\n\r\n### Actual behaviour\r\nThe stored filesize is the size of the encrypted file so that ownCloud-Windows-Client and webdav-clients cannot operate any more. Setting up the correct (decrypted) filesize within the database fixes the problem immediatly!\r\n\r\nThe problem is not there on some files if you are using the Webinterface, because clicking on a file will decrypt the file to the temporary folder immediatly so that the correct file size will be published to the browser.\r\n\r\nThe problem seems to occure, if the webdav-client creates a temporary file for upload-process and moves this file after the upload completes (like FileSync does in default settings). Maybe this upload-encrypt-move-process has a bug!?\r\n\r\n### Server configuration\r\n**Operating system**:\r\nUbuntu 14.04.2 LTS\r\n\r\n**Web server:**\r\nApache (unknown version)\r\n\r\n**Database:**\r\nSQL 5.4\r\n\r\n**PHP version:**\r\nPHP 5.5\r\n\r\n**ownCloud version:** (see ownCloud admin page)\r\n8.1.0.8\r\n\r\n**Updated from an older ownCloud or fresh install:**\r\nfrom an older installation (8.0.2)\r\n\r\n**List of activated apps:**\r\n activity: 2.0.1\r\n - bookmarks: 0.4\r\n - calendar: 0.7.2\r\n - contacts: 0.4.0.0\r\n - documents: 0.10.0\r\n - encryption: 1.0.0\r\n - files: 1.1.9\r\n - files_gpxviewer_extended: 1.4\r\n - files_locking:\r\n - files_pdfviewer: 0.7\r\n - files_sharing: 0.6.2\r\n - files_texteditor: 0.4\r\n - files_trashbin: 0.6.3\r\n - files_versions: 1.0.6\r\n - files_videoviewer: 0.1.3\r\n - firstrunwizard: 1.1\r\n - galleryplus: 13\r\n - mail: 0.1.3\r\n - music: 0.3.6\r\n - tasks: 0.6.0\r\n - updater: 0.6\r\nDisabled:\r\n - external\r\n - files_external\r\n - gallery\r\n - ocsms\r\n - provisioning_api\r\n - templateeditor\r\n - user_external\r\n - user_ldap\r\n - user_webdavauth\r\n\r\n**The content of config/config.php:**\r\n\r\n<?php\r\n$CONFIG = array (\r\n  'instanceid' => 'xxxx',\r\n  'passwordsalt' => 'xxxx',\r\n  'trusted_domains' => \r\n  array (\r\n    0 => 'www.xxxx.de',\r\n    1 => 'cloud.xxxx.de',\r\n    2 => 'xxxx.de',\r\n  ),\r\n  'datadirectory' => '/www/htdocs/xxxx/xxxx/cloud/data',\r\n  'dbtype' => 'mysql',\r\n  'version' => '8.1.0.8',\r\n  'dbname' => 'xxxx',\r\n  'dbhost' => 'localhost',\r\n  'dbtableprefix' => 'oc_',\r\n  'dbuser' => 'xxxx',\r\n  'dbpassword' => 'xxxx',\r\n  'installed' => true,\r\n  'theme' => '',\r\n  'maintenance' => false,\r\n  'mail_from_address' => 'xxxx',\r\n  'mail_smtpmode' => 'php',\r\n  'mail_domain' => 'xxxx.de',\r\n  'forcessl' => true,\r\n  'trashbin_retention_obligation' => 60,\r\n  'trashbin_auto_expire' => true,\r\n  'loglevel' => 2,\r\n  'log_rotate_size' => false,\r\n  'logtimezone' => 'Europe/Berlin',\r\n  'check_for_working_webdav' => true,\r\n  'check_for_working_htaccess' => true,\r\n  'xframe_restriction' => false,\r\n  'secret' => 'xxxx',\r\n  'forceSSLforSubdomains' => true,\r\n  'tempdirectory' => '/www/htdocs/xxxx/tmp',\r\n  'enable_previews' => true,\r\n  'enabledPreviewProviders' => \r\n  array (\r\n    0 => 'OC\\\\Preview\\\\Image',\r\n    1 => 'OC\\\\Preview\\\\MP3',\r\n    2 => 'OC\\\\Preview\\\\TXT',\r\n    3 => 'OC\\\\Preview\\\\MarkDown',\r\n    4 => 'OC\\\\Preview\\\\Illustrator',\r\n    5 => 'OC\\\\Preview\\\\Postscript',\r\n    6 => 'OC\\\\Preview\\\\Photoshop',\r\n    7 => 'OC\\\\Preview\\\\TIFF',\r\n  ),\r\n  'singleuser' => false,\r\n);\r\n\r\n**Are you using external storage, if yes which one:** local/smb/sftp/...\r\nno\r\n\r\n**Are you using encryption:** yes/no\r\nyes\r\n\r\n**Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/...\r\nno\r\n\r\n### Client configuration\r\nownCloud Client 1.8.3\r\n**Browser:**\r\nFirefox 39\r\n\r\n**Operating system:**\r\nWindows 7 64-Bit"},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/126695264","html_url":"https://github.com/owncloud/core/issues/17594#issuecomment-126695264","issue_url":"https://api.github.com/repos/owncloud/core/issues/17594","id":126695264,"user":{"login":"schiesbn","id":1589737,"avatar_url":"https://avatars.githubusercontent.com/u/1589737?v=3","gravatar_id":"","url":"https://api.github.com/users/schiesbn","html_url":"https://github.com/schiesbn","followers_url":"https://api.github.com/users/schiesbn/followers","following_url":"https://api.github.com/users/schiesbn/following{/other_user}","gists_url":"https://api.github.com/users/schiesbn/gists{/gist_id}","starred_url":"https://api.github.com/users/schiesbn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schiesbn/subscriptions","organizations_url":"https://api.github.com/users/schiesbn/orgs","repos_url":"https://api.github.com/users/schiesbn/repos","events_url":"https://api.github.com/users/schiesbn/events{/privacy}","received_events_url":"https://api.github.com/users/schiesbn/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T13:42:35Z","updated_at":"2015-07-31T13:42:35Z","body":"If it is a regular rename the file cache will copy the encryption flag from the source. The problem here is that the source is a part file -> no file cache entry -> nothing to copy for the file cache -> the cache collects the data from scratch -> lead to the situation we have.\r\n\r\nI think we shoud do both, remove the if statement in the storage wrapper because the file cache handles this partial data correctly and change the wrapper to just forward the moveFromStorage() call. I will prepare two separate pull requests for both. Then we can discuss there and also see if all tests pass, etc."}}