Hi everyone,

a question about mime type detection. 

Currently we try to detect the mimetype of every file in ownCloud. This is done 
on local files and also remote files. 
We first check our own mimetype list in ownCloud, than call the php 
mime_content_type call and if this also fails than a system "file" command is 
executed. The results are then stored in the filesystem cache and refreshed 
regularly.

The problem with the second two options is that it requires file access which 
is slow for encrypted files and external filesystems. For example we have to 
download the complete dropbox, google drive, .. where no streaming is 
supported, to detect the mimetypes. This is super slow of course and a 
nightmare. 

The question now is if we really need the exact mime type of every file? I 
think we could improve the performance significantly if we kill the second two 
detection options and only rely on our own mime type list. 


As far as I know we use the mime-types for the searchByMime call to get all 
files with a specific mime-type. But we only need this for well known file 
types like jpeg, mp3 and odt anyways. Searches for more esoteric file types are 
not needed and if yes then we can just add them to our list.

We also send the mime type to the browser during download. But I don't think it 
is a problem if we send an unknown mimetype for unknown filetypes. Apache does 
the same by default too.

We also use the mime types to show the correct file icons and preview in the 
web-interface. But we have a limited number of icons anyways so it should be ok 
if we just make sure that we have all this filetypes in our list.


So in my opinion we could get a very nice big speedup if we stop reading files 
for mime type detection. Especially external storage should be fast and usable 
with this change.

Do I miss something or can we do it like that?


Frank




_______________________________________________
Owncloud mailing list
Owncloud@kde.org
https://mail.kde.org/mailman/listinfo/owncloud

Reply via email to