xtk / X

The X Toolkit
http://www.goXTK.com
Other
795 stars 266 forks source link

Support mime types fallback when loading remote files. #109

Closed musicist288 closed 10 years ago

musicist288 commented 11 years ago

Added mime types lookup for files when loader tries to check for a file format.

Also created a getExtension method in X.file instead of constructing it in checkFileFormat.

Custom mime types were used for file formats that didn't have anything official.

Took the empty string out of the extensions lookup and defaulted to 'application/dicom' if the lookup returns undefined. Ran all of the tests. It looks like selenium test for test_dcm.html was broken before these commits.

haehn commented 11 years ago

Looks fantastic! Will check it out tomorrow and then merge.. Thanks!!!

haehn commented 11 years ago

Just checked the code and it works great for file urls!

Sadly, it doesn't work for local files! Something like:

var m = new X.mesh();
m.file = 'test.stl';
m.filedata = someArraybuffer;

results in: Uncaught TypeError: Cannot call method 'getResponseHeader' of null

This is kind of essential since we use this feature for http://slicedrop.com

Do you have any idea how to solve it?