wordpress-develop icon indicating copy to clipboard operation
wordpress-develop copied to clipboard

Improve fonts upload handling logic for ticket 60835

Open itzmekhokan opened this issue 1 year ago • 5 comments

Improve fonts upload dir handling logic.

Trac ticket: #60835

itzmekhokan avatar Apr 11 '24 09:04 itzmekhokan

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @rockitround.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props khokansardar, peterwilsoncc.

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

github-actions[bot] avatar Apr 11 '24 09:04 github-actions[bot]

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance, it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

github-actions[bot] avatar Apr 11 '24 09:04 github-actions[bot]

This reintroduces the infinite loop bug fixed in #60652 when filtering the font directory. It looks to be a wider issue than the original as the unit tests are timing out due to entering a loop so the relevant test isn't running.

$ ./vendor/bin/phpunit --filter test_fonts_dir_filters_do_not_trigger_infinite_loop
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

F                                                                   1 / 1 (100%)

Time: 00:05.709, Memory: 214.27 MB

There was 1 failure:

1) Tests_Fonts_WpFontDir::test_fonts_dir_filters_do_not_trigger_infinite_loop
Filtering the uploads directory triggered an infinite loop.

It looks to be a wider issue than the

peterwilsoncc avatar Apr 11 '24 22:04 peterwilsoncc

This reintroduces the infinite loop bug fixed in #60652 when filtering the font directory. It looks to be a wider issue than the original as the unit tests are timing out due to entering a loop so the relevant test isn't running.

$ ./vendor/bin/phpunit --filter test_fonts_dir_filters_do_not_trigger_infinite_loop
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

F                                                                   1 / 1 (100%)

Time: 00:05.709, Memory: 214.27 MB

There was 1 failure:

1) Tests_Fonts_WpFontDir::test_fonts_dir_filters_do_not_trigger_infinite_loop
Filtering the uploads directory triggered an infinite loop.

It looks to be a wider issue than the

@peterwilsoncc I have updated the logic of function handle_font_file_upload in WP_REST_Font_Faces_Controller

itzmekhokan avatar Apr 17 '24 04:04 itzmekhokan

Re The backward compatibility break: that's in reference to the code sample I provided earlier. {{{ #!html }}} THANK YOU

rockitround avatar Apr 26 '24 04:04 rockitround