xtk / X

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

File extension required to parse file #106

Open musicist288 opened 11 years ago

musicist288 commented 11 years ago

Consider the following:

this.meshRenderer = new X.renderer3D();
this.meshRenderer.init();
var mesh = new X.mesh();
mesh.file = http://site.com/projects/114/meshes/8/
this.meshRenderer.add(mesh);
this.meshRenderer.render();

Note mesh.file is a RESTful identifier. Currently this code crashes this.meshRenderer because it seems that the parser cannot decide what kind of file it is, or is using a default parsing scheme that is incorrect. However in the response headers there are the following headers:

Content-Type: application/vnd.ms-pki.stl
Content-Disposition: attachment; filename="model.stl"

I think it would be a good idea to detect headers of this sort to not have to force the user into including the name of the file in the url. Preferably the Content-Type would be the dominant indicator and a fallback to the Content-Disposition filename.

haehn commented 11 years ago

These are good thoughts - do you want to contribute?

A workaround right now would be mesh.file = http://site.com/projects/114/meshes/8/?.stl

just pass something to the url so that the parser grabs the extension but the webserver is not confused.

musicist288 commented 11 years ago

Thanks. I can use that work around for the time being. I've forked the repo and will look into implementing this flexibility.