You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WebDAV file copy broken when encryption is enabled #6705
copy the file from one folder to another via webdav
Actual behaviour
without Encryption: files can be copied and can also be opened or renamed
with Encryption: the copy can not be opened with a local text editor, and in the browser, it looks like an "encoding error"
Steps to reproduce
upload a text file "test.txt" with browser
open the owncloud server with a webdav client
create a subdirectory "subdir"
using webdav, copy the text file into "subdir"
open the copy with the local text editor, eg. gedit
open the copy with text editor app in the browser
Server configuration
Operating system: ubuntu 12.04
Web server: apache 2.2
Database: SQLite
PHP version: 5.4.6
ownCloud version: 6.0.0a
Updated from an older ownCloud or fresh install: no
List of activated app:standard apps of owncloud 6.0.0a and encryption
The content of config/config.php: (Without the database password and passwordsalt)
CONFIG = array (
'instanceid' => 'oc0feadd60d8',
Are you using external storage, if yes which one: no
Client configuration
Browser: firefox 26.0
Operating system: ubuntu 12.04
WebDAV client: File manager from ubuntu
More information
I've debugged a bit and it seems the encryption app has no hooks related to file copy.
Note that this only happens for the WebDAV "COPY" operation which, AFAIK, is used neither by the sync client nor the web UI.
This would only affect users with WebDAV clients.
The code does a simple file copy and the target file is actually the encrypted version of the original file.
Maybe the encryption app should have a hook and override the default file copy behavior somehow.
Doing a stream copy instead of a file copy might work as well if it goes through the file proxies that decrypt and reencrypt the file.
Also, I believe that the encryption key for the target file also need to be generated.
Just discovered that there is a view->copy() operation that does a stream copy.
Maybe that one isn't used correctly by the WebDAV connector.
Needs further research.
I'm not sure if the file needs to go through the stream wrapper. If the file is already encrypted we can just make a 1:1 copy, no need to decrypt it and encrypt it again.
Maybe that's also part of the problem, if we don't skip the proxies here it could happen that after the copy operation the file is encrypted twice... Just an idea.
I see, so we could copy the file there but also need to copy the key as well into the new dir, right ? That could happen in the "post copy" hook that isn't implemented yet in the encryption app.
Activity
PVince81 commentedon Jan 9, 2014
FYI @schiesbn
The code does a simple file copy and the target file is actually the encrypted version of the original file.
Maybe the encryption app should have a hook and override the default file copy behavior somehow.
Doing a stream copy instead of a file copy might work as well if it goes through the file proxies that decrypt and reencrypt the file.
Also, I believe that the encryption key for the target file also need to be generated.
karlitschek commentedon Feb 18, 2014
@schiesbn What do you think?
PVince81 commentedon Feb 24, 2014
Just discovered that there is a view->copy() operation that does a stream copy.
Maybe that one isn't used correctly by the WebDAV connector.
Needs further research.
PVince81 commentedon Feb 24, 2014
It seems the stream copy code isn't used because they are on the same mount point: https://github.com/owncloud/core/blob/master/lib/private/files/view.php#L536
So two possible ways to fix this:
or
schiessle commentedon Feb 24, 2014
I'm not sure if the file needs to go through the stream wrapper. If the file is already encrypted we can just make a 1:1 copy, no need to decrypt it and encrypt it again.
Maybe that's also part of the problem, if we don't skip the proxies here it could happen that after the copy operation the file is encrypted twice... Just an idea.
PVince81 commentedon Feb 24, 2014
I see, so we could copy the file there but also need to copy the key as well into the new dir, right ? That could happen in the "post copy" hook that isn't implemented yet in the encryption app.
schiessle commentedon Jul 30, 2014
fixed in master and stable7 (OC7.0.1)