-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Uploading to shared public upload-only Folder fails: Could not rename part file to final file #8942
Comments
Could be related to #8978. @gnunicorn Could you post the entry from the nextcloud.log that contains the mentioned log entries?
|
Just noticed that you are not on the latest patch level. We fixed some stuff in 13.0.4. So please upgrade first and then check again. If this still happens we are happy to reopen this ticket here. |
Thanks for taking the time, @MorrisJobke
Well, we were -- back then patch level was 1.1. And we are experiencing that on the latest patch level, too. We are running 13.0.4 now and still see this problem.
Please do.
While I am not sure about the reasons behind #8978, and therefore it could be related, but there is a distinct difference: we are not on SMB here. We are running the drive on ext4 directly linked into the docker container.
I can't upload the entire file as it contains sensitive information. However, here are the log entries about the trial I just did:
|
Nicely formatted:
@icewind1991 Any idea what the background of this is? |
I'm experiencing the same issue, if I set a folder as upload-only the upload fails but as soon as I change the folder to upload and download the issue dissappears.
After further investigation the issue exists even using local storage, it's not related to external storage. |
Same thing happennig with NC 16.0.1:
|
Can you try if #15769 fixes the issue |
@icewind1991 Nope, same issue. Tried with two different files: an almost empty plain text file and a big file, same exception. If it helps, as soon as I change the shared folder to read and write permissions the file uploads perfectly fine. EDIT. And just noticed something curious, the files GET uploaded, just not renamed. If I rename those part files to the original filename they are perfectly fine: 3d95ec1f822a337dc26081ac9570942f.ocTransferId133638204.part I found that files after configuring an external storage and setting this |
@icewind1991 I took some time today to debug the issue even more. Finally I managed to upload some files without issues by removing |
It seems like that adding 'isreadable' condition to @icewind1991 PR does fixes this issue: change server/apps/dav/lib/Connector/Sabre/File.php Lines 151 to 153 in 3b6df74
from if (!$view->isCreatable($partFilePath) && $view->isUpdatable($this->path)) {
$needsPartFile = false;
} to if ((!$view->isCreatable($partFilePath) && $view->isUpdatable($this->path)) || (!$view->isReadable($partFilePath))) {
$needsPartFile = false;
} |
@Sugaroverdose Confirmed that adding the condition solves the issue, tested with and without |
@MorrisJobke @icewind1991 could you please review proposed fix? |
Thank you @Sugaroverdose for digging 👍 |
It seems like that !isreadable is always true for some reason(not exactly sure, but i've tried couple of uploads and they didn't create .part files), so every upload to shared folder does not apply 'part file' logic (in my case - it's more desirable solution than no upload at all) UPD: tested a little bit more and it's definitely disables .part files for url shared folders even with "Allow upload and editing" set, for some reason !$view->isReadable is always true |
I can confirm that this bug still affects 20.0.9 and 21.0.1 and that the fix described above resolved it for me. @kesselb and @rullzer, is there a reason this fix has not been merged yet? Does it need a PR? Without the fix it is not possible to upload large files using the browser to a write-only share. |
I am using version 21.0.1 and have been affected by this bug (affected all uploads regardless of size for upload-only shares) since April 19th. The problem was reported to me today by a user and was resolved by the patch. |
Is there a PR for this bug? |
I'm also using 21.0.1, and today a user also reported me this problem, and the above patch solved the issue. |
@RafalLukawiecki don't think so, my solution isn't actually fixes issue cause it disables .part file logic for all uploads to url shared directories instead of disabling it only in case of 'upload only' option. Most definitely 'isReadable' is not applicable to folder path as well as to nonexistent files, so to fix this properly eighter 'isReadable' should start to check folders for read permission, or there's should be another way to determine that current user have no permissions to access not yet created .part file |
We're using a Snap install of 20.09 and also have this bug when a folder is set to "File drop". |
Nextcloud 20.0.9 over Debian with php 7.4 Newly created folder shared to newly created user. Sharing folder to user: user cannot upload. Nextcloud 20.1 over Debian with php 7.4 (same server as above but different instance) Sharing folder to user: user can upload. |
It does not work with a share link with or without password. {
"reqId": "Bi6wUQMfKwxUr3E0FmX9",
"level": 3,
"time": "2021-05-06T19:41:30+00:00",
"remoteAddr": "193.32.126.220",
"user": "--",
"app": "webdav",
"method": "PUT",
"url": "/public.php/webdav/test.png",
"message": "renaming part file to final file failed $renameOkay: false, $fileExists: false)",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/2019.04 Iridium/2019.04 Safari/537.36 Chrome/73.0.0.0",
"version": "20.0.9.1"
}
{
"reqId": "Bi6wUQMfKwxUr3E0FmX9",
"level": 4,
"time": "2021-05-06T19:41:30+00:00",
"remoteAddr": "193.32.126.220",
"user": "--",
"app": "webdav",
"method": "PUT",
"url": "/public.php/webdav/test.png",
"message": {
"Exception": "Sabre\\DAV\\Exception",
"Message": "Could not rename part file to final file",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php",
"line": 156,
"function": "put",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
null
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 1104,
"function": "createFile",
"class": "OCA\\DAV\\Connector\\Sabre\\Directory",
"type": "->",
"args": [
"test.png",
null
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
"line": 527,
"function": "createFile",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": [
"test.png",
null,
null
]
},
{
"file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
"line": 89,
"function": "httpPut",
"class": "Sabre\\DAV\\CorePlugin",
"type": "->",
"args": [
{
"__class__": "Sabre\\HTTP\\Request"
},
{
"__class__": "Sabre\\HTTP\\Response"
}
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 474,
"function": "emit",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": [
"method:PUT",
[
{
"__class__": "Sabre\\HTTP\\Request"
},
{
"__class__": "Sabre\\HTTP\\Response"
}
]
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 251,
"function": "invokeMethod",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": [
{
"__class__": "Sabre\\HTTP\\Request"
},
{
"__class__": "Sabre\\HTTP\\Response"
}
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 319,
"function": "start",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/dav/appinfo/v1/publicwebdav.php",
"line": 113,
"function": "exec",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/html/public.php",
"line": 81,
"args": [
"/var/www/html/apps/dav/appinfo/v1/publicwebdav.php"
],
"function": "require_once"
}
],
"File": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"Line": 296,
"CustomMessage": "--"
},
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/2019.04 Iridium/2019.04 Safari/537.36 Chrome/73.0.0.0",
"version": "20.0.9.1"
}
{
"reqId": "Bi6wUQMfKwxUr3E0FmX9",
"level": 3,
"time": "2021-05-06T19:41:30+00:00",
"remoteAddr": "193.32.126.220",
"user": "--",
"app": "PHP",
"method": "PUT",
"url": "/public.php/webdav/test.png",
"message": {
"Exception": "Error",
"Message": "Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#691",
"Code": 0,
"Trace": [
{
"function": "onError",
"class": "OC\\Log\\ErrorHandler",
"type": "::",
"args": [
2,
"Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132)",
"/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
691,
{
"string": "X-Hash-SHA256: 369f6596d1a3bc1fe81d8d25a00a77de8fe34a61c4c4158087ddb4a6ae5efbf9"
}
]
},
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"line": 691,
"function": "header",
"args": [
"X-Hash-SHA256: 369f6596d1a3bc1fe81d8d25a00a77de8fe34a61c4c4158087ddb4a6ae5efbf9"
]
},
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"line": 195,
"function": "header",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
"X-Hash-SHA256: 369f6596d1a3bc1fe81d8d25a00a77de8fe34a61c4c4158087ddb4a6ae5efbf9"
]
},
{
"function": "OCA\\DAV\\Connector\\Sabre\\{closure}",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/lib/private/Files/Stream/HashWrapper.php",
"line": 71,
"function": "call_user_func",
"args": [
{
"__class__": "Closure"
},
"*** sensitive parameter replaced ***"
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 319,
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/dav/appinfo/v1/publicwebdav.php",
"line": 113,
"function": "exec",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/html/public.php",
"line": 81,
"args": [
"/var/www/html/apps/dav/appinfo/v1/publicwebdav.php"
],
"function": "require_once"
}
],
"File": "/var/www/html/lib/private/Log/ErrorHandler.php",
"Line": 91,
"CustomMessage": "--"
},
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/2019.04 Iridium/2019.04 Safari/537.36 Chrome/73.0.0.0",
"version": "20.0.9.1"
}
{
"reqId": "Bi6wUQMfKwxUr3E0FmX9",
"level": 3,
"time": "2021-05-06T19:41:30+00:00",
"remoteAddr": "193.32.126.220",
"user": "--",
"app": "PHP",
"method": "PUT",
"url": "/public.php/webdav/test.png",
"message": {
"Exception": "Error",
"Message": "Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#691",
"Code": 0,
"Trace": [
{
"function": "onError",
"class": "OC\\Log\\ErrorHandler",
"type": "::",
"args": [
2,
"Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132)",
"/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
691,
{
"string": "X-Hash-SHA1: 6c9beda7282bca4f0511416f6a7c42956b77bc62"
}
]
},
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"line": 691,
"function": "header",
"args": [
"X-Hash-SHA1: 6c9beda7282bca4f0511416f6a7c42956b77bc62"
]
},
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"line": 192,
"function": "header",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
"X-Hash-SHA1: 6c9beda7282bca4f0511416f6a7c42956b77bc62"
]
},
{
"function": "OCA\\DAV\\Connector\\Sabre\\{closure}",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/lib/private/Files/Stream/HashWrapper.php",
"line": 71,
"function": "call_user_func",
"args": [
{
"__class__": "Closure"
},
"*** sensitive parameter replaced ***"
]
},
{
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php",
"line": 95,
"function": "fclose",
"args": [
null
]
},
{
"file": "/var/www/html/lib/private/Files/Stream/HashWrapper.php",
"line": 75,
"function": "stream_close",
"class": "Icewind\\Streams\\Wrapper",
"type": "->",
"args": []
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 319,
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/dav/appinfo/v1/publicwebdav.php",
"line": 113,
"function": "exec",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/html/public.php",
"line": 81,
"args": [
"/var/www/html/apps/dav/appinfo/v1/publicwebdav.php"
],
"function": "require_once"
}
],
"File": "/var/www/html/lib/private/Log/ErrorHandler.php",
"Line": 91,
"CustomMessage": "--"
},
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/2019.04 Iridium/2019.04 Safari/537.36 Chrome/73.0.0.0",
"version": "20.0.9.1"
}
{
"reqId": "Bi6wUQMfKwxUr3E0FmX9",
"level": 3,
"time": "2021-05-06T19:41:30+00:00",
"remoteAddr": "193.32.126.220",
"user": "--",
"app": "PHP",
"method": "PUT",
"url": "/public.php/webdav/test.png",
"message": {
"Exception": "Error",
"Message": "Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/apps/dav/lib/Connector/Sabre/File.php#691",
"Code": 0,
"Trace": [
{
"function": "onError",
"class": "OC\\Log\\ErrorHandler",
"type": "::",
"args": [
2,
"Cannot modify header information - headers already sent by (output started at /var/www/html/3rdparty/sabre/http/lib/Sapi.php:132)",
"/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
691,
{
"string": "X-Hash-MD5: 6037bb7acadc733fc2f7600d311547c0"
}
]
},
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"line": 691,
"function": "header",
"args": [
"X-Hash-MD5: 6037bb7acadc733fc2f7600d311547c0"
]
},
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"line": 189,
"function": "header",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
"X-Hash-MD5: 6037bb7acadc733fc2f7600d311547c0"
]
},
{
"function": "OCA\\DAV\\Connector\\Sabre\\{closure}",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/lib/private/Files/Stream/HashWrapper.php",
"line": 71,
"function": "call_user_func",
"args": [
{
"__class__": "Closure"
},
"*** sensitive parameter replaced ***"
]
},
{
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php",
"line": 95,
"function": "fclose",
"args": [
null
]
},
{
"file": "/var/www/html/lib/private/Files/Stream/HashWrapper.php",
"line": 75,
"function": "stream_close",
"class": "Icewind\\Streams\\Wrapper",
"type": "->",
"args": []
},
{
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php",
"line": 95,
"function": "fclose",
"args": [
null
]
},
{
"file": "/var/www/html/lib/private/Files/Stream/HashWrapper.php",
"line": 75,
"function": "stream_close",
"class": "Icewind\\Streams\\Wrapper",
"type": "->",
"args": []
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 319,
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/dav/appinfo/v1/publicwebdav.php",
"line": 113,
"function": "exec",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/html/public.php",
"line": 81,
"args": [
"/var/www/html/apps/dav/appinfo/v1/publicwebdav.php"
],
"function": "require_once"
}
],
"File": "/var/www/html/lib/private/Log/ErrorHandler.php",
"Line": 91,
"CustomMessage": "--"
},
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/2019.04 Iridium/2019.04 Safari/537.36 Chrome/73.0.0.0",
"version": "20.0.9.1"
} |
Administrator of multiple nextclouds, I had a similar case on one (Nextcloud v21) and I confirm that @Sugaroverdose solution solved the problem. Thank you very much! |
Same here, seeing the problem on 2 nextclouds (v20 and v21) and @Sugaroverdose solution did solve the problem, thank you ! |
I just ran into this issue as well with an upload-only folder. Applying the patch above worked for me too. |
Same here, the above patch worked for me as well. |
Hi @Sugaroverdose, do you mind creating a PR with your patch for discussion? |
@szaimen as i said earlier, proposed workaround does actually breaks whole part file logic for url shares, so it's not a proper solution and i don't know how permissions working in nextcloud so i can't really make it anyway better, whole idea is in this quote:
|
btw after thinking a little bit, whole idea of disabling .part file is kinda dumb it would be better to give restrictive per session permission for upload-only user to read it's own .part files so huge file uploads would be possible |
This bug is already present in NC 20.0.10 and 21.0.2. |
Hi, please update to 24.0.8 or better 25.0.2 and report back if it fixes the issue. Thank you! |
Steps to reproduce
Expected behaviour
The file should be uploaded and made available in the directory.
Actual behaviour
The error-message "File could not be uploaded" appears.
Additional Information
It works if I put the sharing on 'upload and edit', but I don't people to be able to edit.
Server configuration detail
Operating system: Linux 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64
Webserver: nginx/1.13.7 (fpm-fcgi)
Database: pgsql PostgreSQL 10.3 (Debian 10.3-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
PHP version: 7.1.15
Modules loaded: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, session, posix, readline, Reflection, standard, SimpleXML, pdo_sqlite, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, cgi-fcgi, apcu, exif, gd, intl, ldap, mcrypt, memcached, mysqli, pcntl, pdo_mysql, pdo_pgsql, pgsql, redis, zip, Zend OPcache
Nextcloud version: 13.0.1 - 13.0.1.1
Updated from an older Nextcloud/ownCloud or fresh install:
Where did you install Nextcloud from: docker
Signing status
Array
List of activated apps
Configuration (config/config.php)
Are you using external storage, if yes which one: local/smb/sftp/...
Are you using encryption: no
Client configuration
Browser: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0
Operating system: Arch Linux
Logs
Nextcloud logged Error
HTTP Response
The console tells me the server responds with a Internal Server Error 500: ``` Sabre\DAV\Exception Could not rename part file to final file ```The text was updated successfully, but these errors were encountered: