Skip to content
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

Font Library: remove has_font_mime_type function #54875

Closed
matiasbenedetto opened this issue Sep 27, 2023 · 1 comment
Closed

Font Library: remove has_font_mime_type function #54875

matiasbenedetto opened this issue Sep 27, 2023 · 1 comment
Labels
[Feature] Typography Font and typography-related issues and PRs Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Code Quality Issues or PRs that relate to code quality [Type] Enhancement A suggestion for improvement.

Comments

@matiasbenedetto
Copy link
Contributor

matiasbenedetto commented Sep 27, 2023

What?

We could simplify the code by entirely removing the WP_Font_Family_Utils::has_font_mime_type() function and its tests.
This was a workaround when we didn't have the wp_handle_upload() mime type checking in place.

public static function has_font_mime_type( $filepath ) {
$filetype = wp_check_filetype( $filepath, WP_Font_Library::ALLOWED_FONT_MIME_TYPES );
return in_array( $filetype['type'], WP_Font_Library::ALLOWED_FONT_MIME_TYPES, true );
}
}

Why?

We can remove it now because it's no longer necessary. The mime type check of the downloaded/uploaded files is done by the core function wp_handle_upload, and a custom check is no longer required.

@matiasbenedetto matiasbenedetto added [Type] Code Quality Issues or PRs that relate to code quality [Feature] Typography Font and typography-related issues and PRs labels Sep 27, 2023
@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Sep 27, 2023
@t-hamano t-hamano added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Dec 5, 2023
@matiasbenedetto
Copy link
Contributor Author

Closing as fixed by: #57364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Typography Font and typography-related issues and PRs Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Code Quality Issues or PRs that relate to code quality [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants