Skip to content

Conversation

@mukeshpanchal27
Copy link
Member

Summary

These PR address the feedback for #1642 (comment).

@mukeshpanchal27 mukeshpanchal27 self-assigned this Nov 18, 2024
@mukeshpanchal27 mukeshpanchal27 added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) no milestone PRs that do not have a defined milestone for release labels Nov 18, 2024
@mukeshpanchal27 mukeshpanchal27 marked this pull request as ready for review November 18, 2024 14:06
@github-actions
Copy link

github-actions bot commented Nov 18, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>
Co-authored-by: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: joemcgill <joemcgill@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@mukeshpanchal27
Copy link
Member Author

It would be good to include these changes in the 2.3.0 release #1657 of the Modern Image Formats plugin.

Copy link
Member

@felixarntz felixarntz left a 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.

if ( '' === $file ) {
$file = get_attached_file( $attachment_id, true );
// File does not exist.
if ( false === $file || ! file_exists( $file ) ) {
Copy link
Member

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.

Suggested change
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 ) ) {
Copy link
Member

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.

@felixarntz felixarntz changed the base branch from trunk to release/3.6.0 November 18, 2024 16:20
@felixarntz felixarntz added this to the webp-uploads 2.3.0 milestone Nov 18, 2024
@felixarntz felixarntz removed the no milestone PRs that do not have a defined milestone for release label Nov 18, 2024
@felixarntz felixarntz changed the title Rename webp_uploads_get_file_mime_type to webp_uploads_get_attachment_file_mime_type Rename webp_uploads_get_file_mime_type to webp_uploads_get_attachment_file_mime_type to clarify scope Nov 18, 2024
@felixarntz felixarntz merged commit e3b36f6 into release/3.6.0 Nov 18, 2024
@felixarntz felixarntz deleted the follow-up-1642 branch November 18, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) [Type] Enhancement A suggestion for improvement of an existing feature

Projects

Status: Done 😃

Development

Successfully merging this pull request may close these issues.

4 participants