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. |
felixarntz
left a comment
There was a problem hiding this comment.
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.
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 ) { |
|
|
||
| $file = get_attached_file( $attachment_id, true ); | ||
| // File does not exist. | ||
| if ( false === $file || ! file_exists( $file ) ) { |
There was a problem hiding this comment.
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_typewebp_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).