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 of 0 bytes files is not possible. #19116

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

Comments

Projects
None yet
6 participants
@SergioBertolinSG
Member

SergioBertolinSG commented Sep 17, 2015

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

This comment has been minimized.

Show comment
Hide comment
@oparoz

oparoz Sep 17, 2015

Contributor

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

okb

Contributor

oparoz commented Sep 17, 2015

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

okb

@SergioBertolinSG

This comment has been minimized.

Show comment
Hide comment
@SergioBertolinSG

SergioBertolinSG Sep 18, 2015

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.

Member

SergioBertolinSG commented Sep 18, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@oparoz

oparoz Sep 18, 2015

Contributor

what browser?

Chrome as well.

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

That would be the difference then :)

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

This comment has been minimized.

Show comment
Hide comment
@gmurayama

gmurayama Sep 25, 2015

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

gmurayama commented Sep 25, 2015

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

This comment has been minimized.

Show comment
Hide comment
@SergioBertolinSG

SergioBertolinSG Jan 20, 2016

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.

Member

SergioBertolinSG commented Jan 20, 2016

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 milestones: 9.1-next, 9.0-current Feb 22, 2016

@PVince81 PVince81 modified the milestones: 9.1-current, 9.2-next Jun 15, 2016

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 14, 2016

Member

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

Member

PVince81 commented Sep 14, 2016

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

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 14, 2016

Member

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.

Member

PVince81 commented Sep 14, 2016

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

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 14, 2016

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.

Member

PVince81 commented Sep 14, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@michaelstingl

michaelstingl Sep 14, 2016

@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 commented Sep 14, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@michaelstingl

michaelstingl Sep 14, 2016

Chrome 53, Mac OS X 10.11.8 ?
*.txt ?
*.blubb ?

michaelstingl commented Sep 14, 2016

Chrome 53, Mac OS X 10.11.8 ?
*.txt ?
*.blubb ?
@SergioBertolinSG

This comment has been minimized.

Show comment
Hide comment
@SergioBertolinSG

SergioBertolinSG Sep 14, 2016

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.

Member

SergioBertolinSG commented Sep 14, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 14, 2016

Member

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

Member

PVince81 commented Sep 14, 2016

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

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 14, 2016

Member

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.

Member

PVince81 commented Sep 14, 2016

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

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 14, 2016

Member

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'"

Member

PVince81 commented Sep 14, 2016

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

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 14, 2016

Member

Fix is here: #26113

Member

PVince81 commented Sep 14, 2016

Fix is here: #26113

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