-
-
Notifications
You must be signed in to change notification settings - Fork 491
[Thumbnail] Fix thumbnail URL for reference format #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Thumbnail] Fix thumbnail URL for reference format #787
Conversation
return $this->thumbnail->generatePrivateUrl($this, $media, $format); | ||
if ($format == 'reference') { | ||
return $this->getReferenceImage($media); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else
is not necessary here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yes, you're right. I'll update this. :)
@NeuralClone, could you add some tests? |
Yeah, I can try to add some tests. I'm not sure when I'll have time to get to that, though. |
I've updated this pull request to include some additional tests for ImageProvider. The tests all pass. I didn't switch over to Yoda conditions for the time being but I'll gladly make those changes if that's desired. Without the fix in |
Ref. for Yoda: symfony/symfony-docs#5402 |
@NeuralClone Please update only your modification with Yoda comparison. Since a fixer will be merged on next version of php-cs-fixer, code will be automatically fixed later anyway. 👍 |
Ok, sounds good! I thought that made more sense. Not sure why I didn't just go with that in the first place. Long weekend I guess? :) Anyway I'll revert this to just my fix plus the tests I added later today. |
This is now back to just my fix and the two tests I added. Sorry for the earlier deviation from that! |
I was just wondering if there was any additional feedback on this pull request. It's been over a month since I originally submitted this and all of the feedback I've received has been about coding styles and standards. While I agree that that stuff is important, it ultimately isn't relevant to the bug this pull request fixes. Nor is it particularly helpful. X-Sendfile is currently broken in this bundle when dealing with images, which makes the bundle mostly worthless when dealing with large image files. Sending large files through HTTP with PHP is rather slow. It doesn't make sense to use that mode when other, superior modes are available for use. And regardless of that, the bundle is supposed to support X-Sendfile. I'm willing to provide additional tests if more are required to verify the existence of this bug and that this pull request fixes it. But since I haven't received any useful feedback since I submitted this, I have no idea where this stands and what the intentions are regarding this bug. Will this fix eventually be merged? If so, any estimate on when that might be? Or is support for X-Sendfile being removed in a later version of the bundle, which would render this fix pointless? Thanks! |
I think this fix doesn't only affects |
I've updated this pull request to simplify the fix and address @phansys's very valid points. The fix itself has been moved into FormatThumbnail::generatePrivateUrl() as that is the source of the problem. Adding the fix to this function, however, makes the function identical to FormatThumbnail::generatePublicUrl(). I decided to make it so the functions aren't reliant on each other. The end result is some code duplication. I don't find this to be ideal but I think it makes the code easier to modify. The obvious way to remove this duplication is to have FormatThumbnail::generatePrivateUrl() call FormatThumbnail::generatePublicUrl(). |
Nothing? It'd be really nice to get this bug fixed. If my approach to fixing it isn't the desired approach, it would be great to know that. I'll gladly make whatever changes are necessary to get this merged. But without much feedback or any update on the status of this in 3 months, I'm starting to feel that fixing bugs isn't on the list of priorities for this project. That's both baffling and disappointing if that's the case. I really do not understand why this continues to be ignored. This is a bug that prevents a major feature from working and it has a trivial fix that was suggested over 2 years ago. |
@NeuralClone I'm sorry but I'm not the best to review this PR on this bundle. I'm sure @rande is not ignoring your PR but have a lot of work to do, just be patient. 👍 Just a question: Is this bug exists also on 2.3? If yes, could you reopen a PR on this branch instead of master? Thanks. |
@soullivaneuh Thanks for the response! I appreciate it. :) I wasn't quite sure who was best to bring this to the attention of. And yes, I'm pretty sure this exists in 2.3 (the bug has existed in some form for quite a while) but I'll double check and create a new PR on that branch if appropriate. |
Thanks. 👍 |
Fixes a bug in Sonata\MediaBundle\Thumbnail\FormatThumbnail::generatePrivateUrl() that causes an incorrect file name to be returned when "reference" format is requested.
This fix is a follow-up to #232 and #277. #277 fixed the issue in FileProvider but left a similar bug in ImageProvider. Credit should go to @tiagojsag for bringing up the original problem and for suggesting a similar fix.
This bug impacts X-Sendfile and X-Accel-Redirect send modes.