jekyll-assets icon indicating copy to clipboard operation
jekyll-assets copied to clipboard

Inconsistent behaviour when using @magic

Open jebbench opened this issue 5 years ago • 2 comments

  • [X] I tried updating to the latest version.
    • [ ] I can't, there is an issue.
  • [ ] I Am on Windows
    • [ ] Ubuntu Bash on Windows
    • [ ] Fedora Bash on Windows
    • [ ] Other Bash on Windows
  • [ ] I Am on Linux
    • [ ] Ubuntu
    • [ ] Fedora
  • [ ] I Am on macOS
  • [X] I'm on Docker
    • [X] I understand Docker may be unsupported.

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.

jebbench avatar Sep 09 '18 09:09 jebbench

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.

envygeeks avatar Sep 09 '18 17:09 envygeeks

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.

jebbench avatar Sep 11 '18 13:09 jebbench