core icon indicating copy to clipboard operation
core copied to clipboard

OwnCloud Web interface does not allow the uploading of files that have an empty mime

Open denniscm20 opened this issue 14 years ago • 20 comments

Steps to reproduce:

  1. Upload a *.R file or a *.bundle file (those are the file types I have tested) via the web interface
  2. When the upload process finishes the following message is displayed: "Unable to upload your file as it is a directory or has 0 bytes"

What is expected: The file should be successfully uploaded.

It seems the problem is related to this line: Line 204 (in the core / apps / files / js / files.js file)

if(files[i].size ==0 || files[i].type== '')

After editing the indicated line, those files are successfully uploaded:

if(files[i].size ==0) 

Also, there seems to be a similar problem when downloading those files (however I was not able to identify the javascript code responsible for the type validation during the download procedure)

denniscm20 avatar Oct 29 '12 23:10 denniscm20

Only checking the filesize will break the check for (at least) newer versions of chrome that return a non-0 size for folders

icewind1991 avatar Oct 30 '12 00:10 icewind1991

Then, what about this alternative?

if (files[i].type== '') {
    if(files[i].size ==0) {
            OC.dialogs.alert(t('files', 'Unable to upload your file as it is a directory or has 0 bytes'), t('files', 'Upload Error'));
                return;
    }
}
// Continue uploading

denniscm20 avatar Oct 30 '12 04:10 denniscm20

This is related to #131 (not possible to upload files without extension).

jancborchardt avatar Oct 30 '12 11:10 jancborchardt

filetype: .epub

I have the same problem: "Unable to upload your file as it is a directory or has 0 bytes" using the native browser web interface. Please supply a fix soon.

Same error message is shown, when I change the file extension. I suppose, it is mime-type related. Please supply a fix soon, as this (bug) breaks usability of ownCloud in many cases.

Keep us informed here, or reply if you need further information and tests.

  • Server version: 4.5.1a

Wikinaut avatar Nov 02 '12 16:11 Wikinaut

Wikinaut avatar Nov 03 '12 16:11 Wikinaut

blocker (usability of owncloud as such)

Wikinaut avatar Nov 03 '12 16:11 Wikinaut

@Wikinaut can you supply more details on your environment? I have no problems with *.epub upload/download for 4.5.1a Linux/Apache/Sqlite

VicDeo avatar Nov 03 '12 21:11 VicDeo

see screenshot

same message

tested in these browsers

  • Firefox 16.0.2
  • IE 8.0
  • Chrome Version 22.0.1229.94 m

Wikinaut avatar Nov 03 '12 22:11 Wikinaut

What operating system are you using?

Wikinaut [email protected] wrote:

see screenshot

same message 

tested in these browsers

Firefox 16.0.2IE 8.0Chrome Version 22.0.1229.94 m

— Reply to this email directly or view it on GitHub.



icewind1991 avatar Nov 03 '12 22:11 icewind1991

  • Windows XP for the clients
  • Server owncloud 4.5.1a runs on OpenSuse 11.3 with Apache2
  • https://

Wikinaut avatar Nov 03 '12 23:11 Wikinaut

Then the problem probably is that windows doesn't detect the mimetype of the file, thus the browser can't distinguish between the file and a folder

Wikinaut [email protected] wrote:

Windows XP

— Reply to this email directly or view it on GitHub.



icewind1991 avatar Nov 03 '12 23:11 icewind1991

bug of owncloud, not of windows.

Wikinaut avatar Nov 03 '12 23:11 Wikinaut

hint:

  • "Dateierweiterung „.epub“ stimmt nicht mit dem MIME-Typ (application/zip) überein."

this is what my mediawiki says when I want to upload my .epub file to my mediawiki installation (of course, having .epub allowed as file type).

So most likely the problem is a mismatch between the extension (epub) and the detected mime type (zip). It should be however allowed to upload such files. We may encounter similar problems when uploading kmz files, for example.

Wikinaut avatar Nov 03 '12 23:11 Wikinaut

Be reminded that uploading via the Windows Client 1.1.1 does work: moving the .epub from my desktop to the owncloud directory on my windows does result in an upload.

Thus, the upload via the browser should work, too.

Wikinaut avatar Nov 03 '12 23:11 Wikinaut

see also

  • https://github.com/owncloud/apps/commit/fadcfe08a7e4592ddc9bd254ac984b45eaa32013 "Do not rely on core mimetype detection"
  • https://github.com/owncloud/android/commit/cce7e1247a5b91d6829b5bcc2f40bd1a47b45512 "assign octet-stream mimetype to unknown type file"

Wikinaut avatar Nov 04 '12 09:11 Wikinaut

Suggestion to change the issue title from

  • OwnCloud Web interface does not allow the uploading of files that have an empty mime

to

  • OwnCloud Web interface does not allow uploading of files that have an empty mime type, or mime-type mismatching file extension

Wikinaut avatar Nov 04 '12 09:11 Wikinaut

This is definitely an ownCloud issue, also the the same bug at https://github.com/owncloud/apps/issues/131

jancborchardt avatar Nov 04 '12 11:11 jancborchardt

Hi , i have the "same" issue if i try to upload a file without extension

the problem is resolved by replacing the " || " back to " && " in

Line 204 (in the core / apps / files / js / files.js file)

if(files[i].size ==0 || files[i].type== '')

(i think you changed it some days ago @icewind1991 no? )

(Firefox 16 on linux) hope it helps a little

eMerzh avatar Nov 06 '12 18:11 eMerzh

I changed it to fix some issues that allowed uploading a "folder" on newer chrome versions

I guess it's best to change it back, since this bug is worse then the one my change solved

icewind1991 avatar Nov 06 '12 19:11 icewind1991

Yeeeeahhhh! :v:

jancborchardt avatar Nov 07 '12 23:11 jancborchardt