Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 430884

Summary: Add support to download/render non-textual/image files.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Mike_Wilson, simon_kaegi
Version: 5.0   
Target Milestone: 6.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2014-03-21 10:39:44 EDT
Currently in the r/o widget we render recognizable image files otherwise we render all other types of file as text.
This will cause issue especially when a nontext file such as zip or war is presented. The user mostly wants to download it when clicking on it.
We should render a "open raw" link in the widget and ask the browser to do the job.
Comment 1 libing wang CLA 2014-04-16 15:20:09 EDT
pushed the support in with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=7afffefeaed607654621eff126ba81048de6cc60.

Currently Safari does not support HTML5 anchor download attribute.
But Chrome and Firefox work well. 
I am turning the "Treat the unrecognized file type as binary" flag off now so it will not render the download link.
Comment 2 libing wang CLA 2014-04-30 15:45:24 EDT
As the Orion file system API does not have an interface of "raw file URL", the only thing we can do is to ask the browser to render/download a blob URL.

Good news:
Both Chrome and FireFox can render some mime types or download unknown binary files.
IE 10, at least supports a native API called saveBlob(blob, fileName).

Bad news:
Safari is able to support blob URL to some extent(e.g. png and pdf), but not for its unknown types like zip or war files. When Safari opens such blob URLs, it just throw errors.

Found some interesting articles regarding the Safari blob URL support.

1). Check if Safari support blob URL
https://github.com/ssorallen/blob-feature-check

2). A thread talking about Safari's bad support for Blob URL. The comments around the bottom is quite new.
https://github.com/eligrey/FileSaver.js/issues/12