tikiatua / internal-assets-plugin

A simple plugin for Craft CMS to allow for private assets
MIT License
33 stars 8 forks source link

stop content-type from being overridden by Craft, fix null being appended to files #22

Closed jooosh closed 4 years ago

jooosh commented 4 years ago

Hi Ramon,

I dug into the codebase and found a fix for the null being appended to the content. Needed to add the content-length to general header section (non-pdfs).

I also discovered that mime-types were not being set properly. Per this solution, I added line 63 setting the response format to raw. You may even be able to remove the PDF specific section now with this in place but I didn't want to mess with it.

Things seems to be solid on my end now.

Thanks again!

tikiatua commented 4 years ago

Hi @jooosh

Thank you very much for looking into this. I was pretty occupied with programming a management system for covid-19 patients the last days and did not manage to check it my self.

I noticed that Yii 2.0 actually has a sendFile method. Maybe it would be even better to leverage this functionality directly. Although I want to dig into the code, to see what the function is actually doing. https://www.yiiframework.com/doc/api/2.0/yii-web-response#sendFile()-detail

jooosh commented 4 years ago

Hi Ramon. Glad to help! What's the best way to get this update from the plugin? Will you push a new release?

I only ask as it would be groovy to have the plugin update from the Craft Plugin Store, but it's currently on version 2.3.1:

image

Hoping you would maybe push a 2.3.2 release.

Or should I just update composer.json to point to another branch?

Thanks in advance!

tikiatua commented 4 years ago

Thanks for reminding me of this. I switched to programming in go quite a while ago and this does not require any separate package management. The version 2.3.2 should now be available via packagist.

jooosh commented 4 years ago

You bet! I just ran the plugin update in Craft and everything worked like a charm. Thanks again for the support and the great plugin. Cheers!