[Owncloud] kill "file" command
Arthur Schiwon
blizzz at owncloud.com
Mon Nov 18 11:00:58 UTC 2013
On Mo, 2013-11-18 at 10:15 +0100, Frank Karlitschek wrote:
> 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.
There will always be people who try to convert files by changing their
extension. I suppose we can sacrifice those. As well as files without
extension.
> 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.
Instead of adding new file types like Esoteric Tarot Cards (.etc) or
similar, it's probably easier to enable apps to add mime types in their
info.xml. So the next grand Tarot app does not need to wait 4 weeks for
the next OC release. Otherwise is could also conflict with
same-abbreviated extension for Ericsson Texutre Compressed Texts. If you
have both apps your screwed, too, but the chance is far smaller.
> 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.
Do I mix something up, or will these lead to make the browser offer to
only save but not open the file directly? This sucks. Plus for a command
line control to add mimetypes manually.
> 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?
Yes, as long as we make sure it's not going to be in the way of the
user.
Cheers
Arthur
More information about the Owncloud
mailing list