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
Renaming a file that contains "+" character in filename causes file to be unreadable (v 7.0.2) #10746
After upgrading owncloud 6 to 7.0.2 I am unable to access some of my files. Most files work, some don't. I believe all of the not-working files are zip-files.
I am getting different error messages depending on application:
Transmit for Mac: "Could not change directory to 'files'. The specified path is not a folder"
OmniFocus for iPhone (trying to sync): Error 403 in response to GET ...
Owncloud Web Interface: "Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." (note: it is not a shared file)
Some additional details: The unreadable files were uploaded by OmniFocus, but not all the files of OmniFocus are unreadable, just some of the zip files. Does OwnCloud handle zip files in a special way that might cause problems?
I checked the logs and found these messages; not sure if they have to do with the problem:
curl_setopt_array(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set at /www/htdocs/w010a165/owncloud/3rdparty/sabre/dav/lib/Sabre/DAV/Client.php#466
set shareFileKeyFailed (code: 10): Cannot mutliKeyDecrypt empty plain content
Undefined index: mime at /www/htdocs/w010a165/owncloud/apps/files/ajax/mimeicon.php#4
set shareFileKeyFailed (code: 20): multiKeyDecrypt with share-keyfailed: error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is not 02
From the logs I'm guessing that you have the encryption app enabled.
Do you have any third party apps enabled ? Do you use the "files_archive" app maybe ?
Apart from the "files_archive" app, there is no special handling for zip files inside of ownCloud.
When OmniFocus uploads new files, are these files readable ?
Are these Zip files bigger than other files ? (in case it's a size issue)
Yes, I have encryption enabled, but not files_archive.
New uploaded zip files are also unreadable. I already tried to set up sync again in another directory, which also resulted in unreachable zip-files.
I tried to check whether the filename (special characters or length) caused the problem, but they didn't. The files are neither empty nor very large, they contain about 1KB of data each. OmniFocus appears to create a file each time it syncs to allow other clients to sync incrementally.
I doubt that it is a problem with OmniFocus as the problems occured immediately after upgrading OwnCloud and OmniFocus has been working for many months without any problems.
Steps to reproduce
1.) Set up OmniFocus 2.0.2 for mac to sync through a directory within owncloud.
2.) Run an initial sync.
3.) The chosen webdav directory will now contain a .client-file, a contents.xml and a .zip file. Further sync operations through the same client will create additional .zip files
4.) zip-files are unreadable on webdav - through the web interface, through a webdav client and by other OmniFocus installations (it appears that the one OmniFocus client that uploaded the zip file does not try to read them again but other clients trying to sync will fail to do so).
Expected behaviour
Files uploaded to webdav should be readable no matter what.
Actual behaviour
zip-files uploaded by OmniFocus are unreadable.
Server configuration
Operating system: Linux dd19014 3.2.0-64-generic #97-Ubuntu SMP Wed Jun 4 22:04:21 UTC 2014 x86_64
Web server: Apache 2.0 Handler
Database: MySQL 5.5.35
PHP version: 5.4.26
ownCloud version: 7.0.2
Updated from an older ownCloud or fresh install: older
List of activated apps:
Activity
Calendar
Contacts
Deleted Files
Documents
Encryption
First Run Wizard
Full Text Search
ownCloud dependencies info
PDF Viewer
Pictures
Share Files
Text Editor
Updater
Versions
Video Viewer
The content of config/config.php:
'ocd08d3bf7e2',
'passwordsalt' => '',
'trusted_domains' =>
array (
0 => '',
),
'datadirectory' => '/www/htdocs//data',
'dbtype' => 'mysql',
'version' => '7.0.2.1',
'dbname' => '',
'dbhost' => 'localhost',
'dbtableprefix' => '',
'dbuser' => '',
'dbpassword' => '',
'installed' => true,
'overwritehost' => 'ssl-account.com',
'overwriteprotocol' => 'https',
'overwritewebroot' => '',
'overwritecondaddr' => '^\.\.\.$',
'forcessl' => true,
'loglevel' => '2',
'theme' => '',
'maintenance' => false,
);
**Are you using external storage, if yes which one:** no
**Are you using encryption:** yes
### Client configuration
**Browser:** Various.
### Logs
#### Web server error log
Hosted service. Don't have access to server logs.
### WebDav Client ("Transmit" for Mac) log
GET //remote.php/webdav//20140829185606%3DimuDXXcPgAJ%2BdAuFA2JwiVW.zip HTTP/1.1
Could not read status line: connection was closed by server
PROPFIND //apps/files_encryption/files/ HTTP/1.1
302 Found
#### ownCloud log (data/owncloud.log)
_(I believe these are the relevant parts)_
{"app":"files_encryption","message":"set shareFileKeyFailed (code: 20): multiKeyDecrypt with share-keyfailed: error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is not 02","level":4,"time":"2014-09-01T19:25:52+00:00"}
{"app":"files_encryption","message":"set shareFileKeyFailed (code: 10): Cannot mutliKeyDecrypt empty plain content","level":4,"time":"2014-09-01T19:31:12+00:00"}
Very strange. What OC 6 version did you have before when everything worked ? OC 6.0.4 ?
I'm not sure what changed regarding encryption but I don't think it should affect zip files that way.
Are you able to upload sane ZIP files manually through the web interface or WebDAV and download them again ? (bypassing Omnifocus)
Just want to confirm that it's really Omnifocus that does something that messes up in ownCloud.
Maybe it's trying to use HTTP range requests for upload ? (maybe splitting the file in multiple chunks). But I don't think this is supported by OC anyway.
Ok, I think I have located the problem: It seems that OF is uploading files named in the format "[something].zip-write-in-progress-[somethingelse]" and then immediately after upload renames them to "[something].zip".
I don't know how the OC encryption system works but I have found that the files_encryption/share-keys directory contains one ".client.[username].sharekey" for each file in my files directry. However, in case of OmniFocus all files in my files directory are named ".zip" and all the share-keys are named ".zip.write-in-progress-[somethingelse].client.[username].sharekey. So it appears that the file gets encrypted after it is uploaded but the renaming is not propagated to the sharekey directory.
It definitely has to do something with renaming... probably with filename length or special characters or the way renaming is handled by the encryption app.
I am now able to recreate the problem manually:
1.) Upload a zip file through webdav.
2.) Name it "20140829185547=mV-zmASDxGD+nzUvJUmGeTp.zip"
3.) Confirm the file is still readable at this point.
4.) Rename file to "20140829185547=mV-zmASDxGD+nzUvJUmGeTpx.zip" (note I added an "x" before the ".zip").
5.) File now unreadable through webdav. Owncloud web interface shows an encryption error. "Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you."
1.) Upload any zip file called a.zip -- confirm file is readable
2.) Rename to a+b.zip -- file still readable
3.) Rename to a+bc.zip -- file unreadable.
4.) Rename to a+b.zip -- file is readable again.
changed the title [-]Unable to read some files after upgrade to 7.0.2[/-][+]Renaming a file that contains "+" character in filename causes file to be unreadable (v 7.0.2)[/+]on Sep 2, 2014
@rolandu thanks for your research.
Usually issues with "+" characters are due to the web server config issue, for example plugins that try and rewrite the URL in a wrong way.
But in such cases I would expect the server to just return a 404 instead of the error message about not being able to decrypt the file.
Are you using an old Apache ? Your report states 2.0.
Needs further research. That information should hopefully be enough to reproduce the issue locally.
I went over to demo.owncloud.org (which runs OC 7.0.2) and created a folder called "test special + % chars" over the UI.
Then I created a text file inside called "plus + and percent %.txt"
Then when extracting the zip file:
% unzip test\ special\ +\ %\ chars.zip
Archive: test special + % chars.zip
creating: test special + % chars/
extracting: test special + % chars/plus + and percent %.txt
All is fine.
Then I renamed both the file and folder to a different name also containing "+" and "%", it worked fine as well.
Then I tried renaming both using the WebDAV interface, it also worked without problems.
Would be good if you guys @ttl76543@utack could compare your environments / PHP modules, maybe there's a pattern to be found that would help find out what is interfering with the URLs.
@ttl76543 do you have two running OC instances in the same environment ? Are you sure the env itself didn't change between your upgrades ? (like distro update or PHP module updates)
—
Reply to this email directly or view it on GitHub.
I just tried the same steps on my private ownCloud which is 7.0.2 and encryption and managed to reproduce the issue with WebDAV renaming and "+" or "%" special chars.
Will try and narrow down the exact step and post them.
Now I'm really confused.
Sometimes it works, sometimes it doesn't.
A folder that I tried to download at first appeared as an empty ZIP file. But then I went into that folder and downloaded the text file and I could open it without issues. And after that suddenly downloading the folder worked again...
Managed to reproduce it with shorter steps and folder without special chars:
Enable encryption
Create folder "a folder"
Create non-empty file (important!) called "text plus +.txt" inside that folder
Download "a folder" as zip: works
With WebDAV, rename the file to "text plus + renamed again.txt"
Getting this in the logs:
{"reqId":"5433b40e09fc1","app":"webdav","message":"Sabre\\DAV\\Exception\\NotFound: File with name a folder\/text plus + renamed again.txt could not be located","level":0,"time":"2014-10-07T09:36:14+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/a%20folder\/text%20plus%20+%20renamed%20again.txt"}
{"reqId":"5433b40e313c7","app":"PHP","message":"json_encode(): Invalid UTF-8 sequence in argument at \/srv\/www\/htdocs\/owncloud\/lib\/private\/log\/owncloud.php#86","level":3,"time":"2014-10-07T09:36:14+00:00","method":"MOVE","url":"\/owncloud\/remote.php\/webdav\/a%20folder\/text%20plus%20+.txt"}
{"reqId":"5433b40e313c7","app":"files_encryption","message":null,"level":4,"time":"2014-10-07T09:36:14+00:00","method":"MOVE","url":"\/owncloud\/remote.php\/webdav\/a%20folder\/text%20plus%20+.txt"}
Seems I need to rename the file multiple times before it happens.
And when it does:
{"reqId":"5433b4daf04c3","app":"webdav","message":"Sabre\\DAV\\Exception\\NotFound: File with name a folder + renamed\/text plus + renamed again xxxxxxxxxxx.txt could not be located","level":0,"time":"2014-10-07T09:39:38+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/a%20folder%20+%20renamed\/text%20plus%20+%20renamed%20again%20xxxxxxxxxxx.txt"}
{"reqId":"5433b4db22f73","app":"files_encryption","message":"set shareFileKeyFailed (code: 20): multiKeyDecrypt with share-keyfailed: error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is not 02","level":4,"time":"2014-10-07T09:39:39+00:00","method":"MOVE","url":"\/owncloud\/remote.php\/webdav\/a%20folder%20+%20renamed\/text%20plus%20+%20renamed%20again.txt"}
{"reqId":"5433b4dfbf504","app":"PHP","message":"Cannot modify header information - headers already sent by (output started at \/srv\/www\/htdocs\/owncloud\/3rdparty\/mcnetic\/phpzipstreamer\/ZipStreamer.php:237) at \/srv\/www\/htdocs\/owncloud\/apps\/files_encryption\/lib\/helper.php#378","level":3,"time":"2014-10-07T09:39:43+00:00","method":"GET","url":"\/owncloud\/index.php\/apps\/files\/ajax\/download.php?dir=%2F&files=a%20folder%20%2B%20renamed"}
I had a look in the encryption folders and the share keys haven't been renamed:
keyfiles/a folder + renamed:
total 4.0K
-rw-r--r-- 1 wwwrun www 44 Oct 7 11:39 text plus + renamed again xxxxxxxxxxx.txt.key
share-keys/a folder + renamed:
total 4.0K
-rw-r--r-- 1 wwwrun www 512 Oct 7 11:39 text plus + renamed again.txt.root.shareKey
I think I know what's happening: the encryption code had some unescaped regex when trying to match share keys... and characters like "+" and "%" are likely to mess up a regex...
This also means that not ALL file names containing with "+" will fail renaming, only such that are likely to mess up regexes.
The original issue is here: #11127
It's already fixed on stable7 (the upcoming 7.0.3).
Just tried stable7 and couldn't reproduce the issue there.
The fix is here #11137 in case you'd like to patch your setup.
Would be good to try it out and confirm whether it indeed fixes the issue for you as well.
Activity
rolandu commentedon Aug 30, 2014
Some additional details: The unreadable files were uploaded by OmniFocus, but not all the files of OmniFocus are unreadable, just some of the zip files. Does OwnCloud handle zip files in a special way that might cause problems?
I checked the logs and found these messages; not sure if they have to do with the problem:
curl_setopt_array(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set at /www/htdocs/w010a165/owncloud/3rdparty/sabre/dav/lib/Sabre/DAV/Client.php#466
set shareFileKeyFailed (code: 10): Cannot mutliKeyDecrypt empty plain content
Undefined index: mime at /www/htdocs/w010a165/owncloud/apps/files/ajax/mimeicon.php#4
set shareFileKeyFailed (code: 20): multiKeyDecrypt with share-keyfailed: error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is not 02
karlitschek commentedon Aug 31, 2014
@schiesbn any idea?
PVince81 commentedon Sep 1, 2014
Can you please use the issue template: https://raw.github.com/owncloud/core/master/issue_template.md
From the logs I'm guessing that you have the encryption app enabled.
Do you have any third party apps enabled ? Do you use the "files_archive" app maybe ?
Apart from the "files_archive" app, there is no special handling for zip files inside of ownCloud.
When OmniFocus uploads new files, are these files readable ?
Are these Zip files bigger than other files ? (in case it's a size issue)
rolandu commentedon Sep 1, 2014
Yes, I have encryption enabled, but not files_archive.
New uploaded zip files are also unreadable. I already tried to set up sync again in another directory, which also resulted in unreachable zip-files.
I tried to check whether the filename (special characters or length) caused the problem, but they didn't. The files are neither empty nor very large, they contain about 1KB of data each. OmniFocus appears to create a file each time it syncs to allow other clients to sync incrementally.
I doubt that it is a problem with OmniFocus as the problems occured immediately after upgrading OwnCloud and OmniFocus has been working for many months without any problems.
Steps to reproduce
1.) Set up OmniFocus 2.0.2 for mac to sync through a directory within owncloud.
2.) Run an initial sync.
3.) The chosen webdav directory will now contain a .client-file, a contents.xml and a .zip file. Further sync operations through the same client will create additional .zip files
4.) zip-files are unreadable on webdav - through the web interface, through a webdav client and by other OmniFocus installations (it appears that the one OmniFocus client that uploaded the zip file does not try to read them again but other clients trying to sync will fail to do so).
Expected behaviour
Actual behaviour
Server configuration
Operating system: Linux dd19014 3.2.0-64-generic #97-Ubuntu SMP Wed Jun 4 22:04:21 UTC 2014 x86_64
Web server: Apache 2.0 Handler
Database: MySQL 5.5.35
PHP version: 5.4.26
ownCloud version: 7.0.2
Updated from an older ownCloud or fresh install: older
List of activated apps:
The content of config/config.php:
'ocd08d3bf7e2', 'passwordsalt' => '', 'trusted_domains' => array ( 0 => '', ), 'datadirectory' => '/www/htdocs//data', 'dbtype' => 'mysql', 'version' => '7.0.2.1', 'dbname' => '', 'dbhost' => 'localhost', 'dbtableprefix' => '', 'dbuser' => '', 'dbpassword' => '', 'installed' => true, 'overwritehost' => 'ssl-account.com', 'overwriteprotocol' => 'https', 'overwritewebroot' => '', 'overwritecondaddr' => '^\.\.\.$', 'forcessl' => true, 'loglevel' => '2', 'theme' => '', 'maintenance' => false, ); **Are you using external storage, if yes which one:** no **Are you using encryption:** yes ### Client configuration **Browser:** Various. ### Logs #### Web server error log Hosted service. Don't have access to server logs. ### WebDav Client ("Transmit" for Mac) log GET //remote.php/webdav//20140829185606%3DimuDXXcPgAJ%2BdAuFA2JwiVW.zip HTTP/1.1 Could not read status line: connection was closed by server PROPFIND //apps/files_encryption/files/ HTTP/1.1 302 Found #### ownCloud log (data/owncloud.log) _(I believe these are the relevant parts)_ {"app":"files_encryption","message":"set shareFileKeyFailed (code: 20): multiKeyDecrypt with share-keyfailed: error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is not 02","level":4,"time":"2014-09-01T19:25:52+00:00"} {"app":"files_encryption","message":"set shareFileKeyFailed (code: 10): Cannot mutliKeyDecrypt empty plain content","level":4,"time":"2014-09-01T19:31:12+00:00"}PVince81 commentedon Sep 1, 2014
Very strange. What OC 6 version did you have before when everything worked ? OC 6.0.4 ?
I'm not sure what changed regarding encryption but I don't think it should affect zip files that way.
Are you able to upload sane ZIP files manually through the web interface or WebDAV and download them again ? (bypassing Omnifocus)
Just want to confirm that it's really Omnifocus that does something that messes up in ownCloud.
Maybe it's trying to use HTTP range requests for upload ? (maybe splitting the file in multiple chunks). But I don't think this is supported by OC anyway.
rolandu commentedon Sep 2, 2014
Yes, zip files uploaded through Transmit work well, even if put into the same location and carrying the same name as OmniFocus files.
rolandu commentedon Sep 2, 2014
Ok, I think I have located the problem: It seems that OF is uploading files named in the format "[something].zip-write-in-progress-[somethingelse]" and then immediately after upload renames them to "[something].zip".
I don't know how the OC encryption system works but I have found that the files_encryption/share-keys directory contains one ".client.[username].sharekey" for each file in my files directry. However, in case of OmniFocus all files in my files directory are named ".zip" and all the share-keys are named ".zip.write-in-progress-[somethingelse].client.[username].sharekey. So it appears that the file gets encrypted after it is uploaded but the renaming is not propagated to the sharekey directory.
It definitely has to do something with renaming... probably with filename length or special characters or the way renaming is handled by the encryption app.
I am now able to recreate the problem manually:
1.) Upload a zip file through webdav.
2.) Name it "20140829185547=mV-zmASDxGD+nzUvJUmGeTp.zip"
3.) Confirm the file is still readable at this point.
4.) Rename file to "20140829185547=mV-zmASDxGD+nzUvJUmGeTpx.zip" (note I added an "x" before the ".zip").
5.) File now unreadable through webdav. Owncloud web interface shows an encryption error. "Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you."
rolandu commentedon Sep 2, 2014
Ok, narrowed it down to the "+" character.
1.) Upload any zip file called a.zip -- confirm file is readable
2.) Rename to a+b.zip -- file still readable
3.) Rename to a+bc.zip -- file unreadable.
4.) Rename to a+b.zip -- file is readable again.
[-]Unable to read some files after upgrade to 7.0.2[/-][+]Renaming a file that contains "+" character in filename causes file to be unreadable (v 7.0.2)[/+]PVince81 commentedon Sep 3, 2014
@rolandu thanks for your research.
Usually issues with "+" characters are due to the web server config issue, for example plugins that try and rewrite the URL in a wrong way.
But in such cases I would expect the server to just return a 404 instead of the error message about not being able to decrypt the file.
Are you using an old Apache ? Your report states 2.0.
Needs further research. That information should hopefully be enough to reproduce the issue locally.
PVince81 commentedon Sep 3, 2014
CC @schiesbn
8 remaining items
rolandu commentedon Oct 7, 2014
Is the demo-site encrypted? It was mentioned that this appears to be a problem with the encryption module.
PVince81 commentedon Oct 7, 2014
I believet the demo site is not encrypted.
I just tried the same steps on my private ownCloud which is 7.0.2 and encryption and managed to reproduce the issue with WebDAV renaming and "+" or "%" special chars.
Will try and narrow down the exact step and post them.
PVince81 commentedon Oct 7, 2014
Steps to reproduce:
Expected result
Folder can be downloaded as ZIP
Actual result
At step 9, downloaded ZIP file is empty
Versions
ownCloud 7.0.2
Env
openSUSE 13.1 x86_64
Apache 2.4
PHP 5.4.20
Edit: fixed report as I forgot to refresh the page while testing
PVince81 commentedon Oct 7, 2014
@rolandu in your comment #10746 (comment) did you mean "rename with WebDAV" or "rename in OmniFocus" ?
Because it seems that renaming over the Web UI doesn't trigger the issue. Key is renaming with WebDAV.
Next up: trying to rename with cadaver and the sync client
PVince81 commentedon Oct 7, 2014
Now I'm really confused.
Sometimes it works, sometimes it doesn't.
A folder that I tried to download at first appeared as an empty ZIP file. But then I went into that folder and downloaded the text file and I could open it without issues. And after that suddenly downloading the folder worked again...
PVince81 commentedon Oct 7, 2014
Managed to reproduce it with shorter steps and folder without special chars:
Getting this in the logs:
PVince81 commentedon Oct 7, 2014
Seems I need to rename the file multiple times before it happens.
And when it does:
PVince81 commentedon Oct 7, 2014
I had a look in the encryption folders and the share keys haven't been renamed:
I think I know what's happening: the encryption code had some unescaped regex when trying to match share keys... and characters like "+" and "%" are likely to mess up a regex...
This also means that not ALL file names containing with "+" will fail renaming, only such that are likely to mess up regexes.
The original issue is here: #11127
It's already fixed on stable7 (the upcoming 7.0.3).
Just tried stable7 and couldn't reproduce the issue there.
The fix is here #11137 in case you'd like to patch your setup.
Would be good to try it out and confirm whether it indeed fixes the issue for you as well.
Thanks.
PVince81 commentedon Oct 27, 2014
Closing, this should be fixed already in 7.0.3 RC1.
If you still experience the issue in that version, feel free to reopen.