-
Notifications
You must be signed in to change notification settings - Fork 102
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
Rename webp_uploads_get_file_mime_type
to webp_uploads_get_attachment_file_mime_type
to clarify scope
#1662
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
It would be good to include these changes in the 2.3.0 release #1657 of the Modern Image Formats plugin. |
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.
Thanks @mukeshpanchal27, this looks almost good to go.
I agree this should go into today's release, as that's otherwise introducing the function under the wrong name.
plugins/webp-uploads/helper.php
Outdated
if ( '' === $file ) { | ||
$file = get_attached_file( $attachment_id, true ); | ||
// File does not exist. | ||
if ( false === $file || ! file_exists( $file ) ) { |
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.
This function doesn't do anything with the actual file contents, so the second check here is irrelevant. It would also be inconsistent to only do it when no $file
was provided. We can remove it.
if ( false === $file || ! file_exists( $file ) ) { | |
if ( false === $file ) { |
@@ -23,13 +23,7 @@ function webp_uploads_wrap_image_in_picture( string $image, string $context, int | |||
return $image; | |||
} | |||
|
|||
$file = get_attached_file( $attachment_id, true ); | |||
// File does not exist. | |||
if ( false === $file || ! file_exists( $file ) ) { |
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.
Related to the above, the file_exists()
check was never needed here anyway, so this is okay to be removed.
webp_uploads_get_file_mime_type
to webp_uploads_get_attachment_file_mime_type
webp_uploads_get_file_mime_type
to webp_uploads_get_attachment_file_mime_type
to clarify scope
Summary
These PR address the feedback for #1642 (comment).