[wp-trac] [WordPress Trac] #60835: Fix and improve handling of uploading of font files

WordPress Trac noreply at wordpress.org
Sun Jun 2 22:42:07 UTC 2024


#60835: Fix and improve handling of uploading of font files
----------------------------------------------------+---------------------
 Reporter:  azaozz                                  |       Owner:  (none)
     Type:  enhancement                             |      Status:  new
 Priority:  normal                                  |   Milestone:  6.6
Component:  Upload                                  |     Version:
 Severity:  normal                                  |  Resolution:
 Keywords:  needs-testing has-patch has-unit-tests  |     Focuses:
----------------------------------------------------+---------------------
Changes (by peterwilsoncc):

 * type:  defect (bug) => enhancement


Comment:

 As the WordPress 6.6 beta is approaching, I'll post my thoughts on the
 [https://github.com/WordPress/wordpress-develop/pull/6407 linked pull
 request]:

 The pull request significantly modifies the upload API to allow themes and
 plugins to bypass the default handling of WordPress uploads with the code
 that follows. Such code would allow themes and plugins to bypass bucket
 offloaders and make incorrect assumptions about the location of the upload
 directory.

 Such changes are well beyond the scope of the changes this ticket aims to
 make.

 {{{#!php
 <?php
 $uploaded_file = wp_handle_sideload(
         $file,
         array(
                 'test_form'   => false,
                 'upload_dir' => array(
                         'path'    => ABSPATH,
                         'url'     => site_url(),
                         'subdir'  => '',
                         'basedir' => ABSPATH,
                         'baseurl' => site_url(),
                         'error'   => false,
                 ),
         )
 );
 }}}


 Effectively the font library introduces a context for uploads (the default
 being media library, the font library being `fonts`). The lightest touch
 changes for this ticket are to make use of a `$context` parameter/override
 in the various upload and media library related functions.

 As this change is a refactor of existing code that is largely unchanged
 since it was introduced in
 [https://github.com/WordPress/gutenberg/pull/52704#discussion_r1269940796
 GB#52704] and the code operates as intended (placing fonts in a separate
 directory), I've modified the ticket type to an enhancement.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60835#comment:47>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list