Uploading of 0 bytes files is not possible. #19116

Closed
SergioBertolinSG opened this Issue Sep 17, 2015 · 15 comments

Projects

None yet

6 participants

@SergioBertolinSG
Member

Steps to reproduce

  1. Upload an empty file (0 bytes) using the web ui.

Expected behaviour

File is uploaded.

Actual behaviour

File is not uploaded because it has 0 bytes.

Server configuration

Operating system:
Ubuntu 14.04

Web server:
Apache

Database:
MySQL

PHP version:
5.5.9

ownCloud version: (see ownCloud admin page)
master
{"installed":true,"maintenance":false,"version":"8.2.0.4","versionstring":"8.2 pre alpha","edition":""}

Updated from an older ownCloud or fresh install:
Fresh

List of activated apps:
Default in enterprise edition.

The content of config/config.php:


Are you using external storage, if yes which one: local/smb/sftp/...
No

Are you using encryption:
No

Logs

Client configuration

browser
Chrome.

@oparoz
Contributor
oparoz commented Sep 17, 2015

I'm on 8.2.0.5 and was able to upload a 0Kb text file

okb

@SergioBertolinSG
Member

@oparoz what browser?

I have seen that after some time, it works. (today it works, yesterday it didn't in the same server same browser).
But when creating a new instance you can't upload it.

I guess it is a problem with new users uploading 0 bytes files.

@oparoz
Contributor
oparoz commented Sep 18, 2015

what browser?

Chrome as well.

But when creating a new instance you can't upload it.

That would be the difference then :)

@gmurayama

I tested as well and got the same problem. I can work on to fix it.
Apparently, this bug happen only on Chrome.

@SergioBertolinSG SergioBertolinSG added this to the 9.0-current milestone Jan 20, 2016
@SergioBertolinSG
Member

Still happening on master (2016-01-20). I find this very annoying when you have a 0 bytes file inside a group of files and the upload is not possible.

@PVince81 PVince81 added the app:files label Feb 8, 2016
@cmonteroluque cmonteroluque modified the milestone: 9.1-next, 9.0-current Feb 22, 2016
@PVince81 PVince81 modified the milestone: 9.1-current, 9.2-next Jun 15, 2016
@PVince81
Collaborator

Weird, I just tried on stable9.1 and master and dragging a zero bytes file into Firefox 48 and Chromium 51 and it worked.

@PVince81
Collaborator

Okay, so @michaelstingl reported that on v9.1.0 with Chromium 35 on a Mac it doesn't work.
On Linux it works for me, so it could be platform specific.

@PVince81
Collaborator

@SergioBertolinSG when you tested was it also from a Mac ? Would be good to get more data about which systems it works on and which don't.

@michaelstingl

@PVince81 EmptyTest.txt with 0 byte worked for me, but uncommon/unknown file extension like EmptyTest.blubb with 0 byte don't work.

emptytest_-_files_-_owncloud

Error uploading file "EmptyTest.blubb": Unable to upload EmptyTest.blubb as it is a directory or has 0 bytes

Client configuration

Browser:
Chrome 53

Operating system:
Mac OS 10.11.8

00006142

@michaelstingl
michaelstingl commented Sep 14, 2016 edited
Chrome 53, Mac OS X 10.11.8 ?
*.txt ?
*.blubb ?
@SergioBertolinSG
Member

@SergioBertolinSG when you tested was it also from a Mac ? Would be good to get more data about which systems it works on and which don't.

I tested this on a mac. But I've tested it again and found that the problem is the file not the OS.
It is the extension, like Michael has pointed which makes it fail. I found this with a .log file. So I guess the mimetype is involved.

Another thing I've seen is that changing the extension in linux doesn't make the behaviour change. But in mac it does. When uploading a file which was a .log file from linux it fails and refresh automatically the web ui.

@PVince81
Collaborator

Confirmed, I can reproduce the issue with a different extension.

@PVince81
Collaborator

Once upon a time an eager developer added a feature to make it possible to upload folders in Chromium. However as this feature doesn't work in other browsers, a check was put in that tries to detect when people try uploading folders with such browsers. Unfortunately the way how the check is implemented would also filter out zero-byte files that have no mime type !

This line: https://github.com/owncloud/core/blob/v9.0.4/apps/files/js/file-upload.js#L341

Now the problem is that if we modify this check to allow empty files again, we'll also lose the error message in case of folder upload with unsupported browsers. I checked the File object from such upload and there is no accurate way of detecting a failed folder upload, it simply appears like an empty file...

So let's remove the error message and allow uploading empty files again.

@PVince81
Collaborator

I just did some testing and in Firefox when uploading a directory, readAsBinaryString() is supposed to throw an exception but it doesn't... any more? So we can't show that error message any more in Firefox, so users will have to do with "Could not upload file 'directory'"

@PVince81 PVince81 referenced this issue Sep 14, 2016
Merged

Allow uploading empty files #26113

4 of 12 tasks complete
@PVince81
Collaborator

Fix is here: #26113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment