Forum OpenACS Development: Re: cr_write_content filename header

Collapse
Posted by Ryan Gallimore on
cr_write_content has a storage type switch with text and file cases. The file case even sets another header already. I think it would be reasonable to set the filename header here so you don't have to remember to set it every time in the caller.
Collapse
Posted by Dave Bauer on
It sets the content size header due to a limitation on ns_returnfile.

There is no requirement that an item stores using filesystem storage have the original filename stored are cr_items.name, so you can't reliably set the attachment header with the correct download filename unless you know how you stored it.

The file.vuh handler deals with this by allowing a filename to be appended to the URL ie:

/file/12345/example.doc

the image vuh handler also allows this.

In this way the code that generates the URLs, if it has the correct filename information, can set the URL with the proper filename.

I don't really have a strong opinion either way, but automatically setting the attachment header is cr_write_content will most likely cause some unexpected behavior somewhere.

Collapse
Posted by Ryan Gallimore on
Thanks Dave, I didn't notice the filename could be included in the URL.