eexit / ghost-storage-cloudinary

:rocket: A fully-featured and deeply tested Cloudinary Ghost storage adapter

Home Page:https://ghost.org/integrations/cloudinary/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fetch.secure is only applied at time of upload, not actually when fetching

kevinstadler opened this issue · comments

commented

More an idea for an enhancement rather than a bug: I started off using the recommended fetch.secure: false but ended up having to change to secure: true because our site is served over https and most browsers didn't like us dynamically requesting content from a non-secured site. I assumed that the storage adapter would just change all picture URLs from http:// to https:// but to my surprise all previously uploaded pictures were still requested over http, only those uploaded after the config change got a https:// path by default.
I understand that this probably has to do with how storage adapters fit into the Ghost architecture (storing a fixed path to the image at the time of upload) but especially given the name of the config setting I found it deeply unintuitive that previously uploaded images were unaffected. I wonder if there is a safe way for the storage adapter to check all the URLs in the Ghost storage and update any cloudinary URLs which have the wrong protocol? It seems like the storage adapter isn't actually queried when Ghost generates the <img> tags, so this might have to happen during the adapter initialisation...

Hi @kevinstadler,

Indeed, there's a need to set the appropriate config as soon as possible because once the links are generated, they are stored as it into the blog post. Unless you edit all your previous posts to update the scheme, the storage adapter has nothing to do with this once the URL is generated.

Before I migrated all my content to Cloudinary, I made many tests using or not TLS and resulting in the need to update several times all my generated URLs.
Fortunately, the import/export feature of Ghost is pretty accurate so you are always export your content, throw a mass replace using Regex then re-import.

I hope this helps and thanks for the feedback.
Regards,