Do not attempt to generate thumbs for svg files (fixes upload of svg files) #2090
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi everyone. First of all let me thank you for this fantastic project.
What is this pull request for?
While trying to set up a new alchemy based project a colleague of mine discovered a small problem: He was not able to upload any
.svg
files. I could reproduce this with currentmain
branch. The exception we hit was:I did a little digging and found that the missing
#steps
method is called onAlchemy::PictureVariant#image
. The documentation of that method explicitly says that it can either return aDragonfly::Attachment
or aDragonfly::Job
. Only the latter seems to have this#steps
method.In this case I think a
Dragonfly::Job
is only returned for raster image formats for which an actual thumbnail is being generated. For other formats, any conversions are skipped and aDragonfly::Attachment
is being returned.Notable changes
I was not 100% how to fix this. So please find my first clumsy attempt attached. I decided that the whole thumbnail (pre-)generation probably only makes sense for those formats that can actually be converted this way. So I tried to shut this off as early as possible.
Feel free to discard this if it does not make sense. Also, please let me know if I can improve on this in any way.
Checklist