envygeeks / jekyll-assets

:art: Asset pipelines for Jekyll.
ISC License
1.12k stars 170 forks source link

Inconsistent behaviour when using @magic #561

Open jebbench opened 6 years ago

jebbench commented 6 years ago

Description

Using the magic proxy requires the file extensions on images; when no proxy is used the extension is optional.

This works: {% asset 'my_image.jpg' magick:resize=300x300 %}

This works: {% asset 'my_image' %}

This doesn't: {% asset 'my_image' magick:resize=300x300 %}

The proxy image is generated in .jekyll-cache but no img tag is placed in the output; there is no error message on the jekyll serve console.

I've not tested this with any other proxies or file types.

Expected

I would expect consistent behaviour or an error message in the console pointing out that extensions are required when using the magic proxy; I spent an hour trying to figure out why adding a proxy disappeared my image and an error message would have really helped.

envygeeks commented 6 years ago

TBH the only thing I would be willing to do is remove all support for extensionless files. But not before 4.0 because this would break known, and accepted behavior.

On that, if we don't get an error, we don't pass an error, and the routing logic between HTML, and asset doesn't need to throw an error, because there was no error. If you chose to not to use an extension and Sprockets can't type your file, we can't find anything that matches the content type, we ignore the file. That is by design, and this falls into a corner case scenario.

This kind of problem is why we have debug logging.

jebbench commented 6 years ago

Always requiring the extensions makes a lot of sense to me.

I'm not sure I follow the logic behind ignoring the file if it can't be found but I'll take your word for it.

It was the debug logging that led me to the file extension in the end; as I say I was surprised there wasn't an error when the file cound't be found.