[wp-trac] [WordPress Trac] #42437: Thumbnails can overwrite other uploads if filename matches

WordPress Trac noreply at wordpress.org
Wed May 16 15:14:28 UTC 2018


#42437: Thumbnails can overwrite other uploads if filename matches
--------------------------+-----------------------------
 Reporter:  Viper007Bond  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Upload        |     Version:  4.8.3
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------

Comment (by pbiron):

 The patch I just added is just "proof-of-concept", and is clearly not
 ready for merge!

 It implementis the idea in
 [[https://core.trac.wordpress.org/ticket/42437#comment:5|@azaozz's
 comment]].

 Additionally, it also appends `-1`, etc to original filenames that no
 **not** contain dimension-like sub-strings if their intermediate size
 filenames would conflict with original filenames that did contain such
 sub-strings that were uploaded prior to the patch being applied.  I have
 no idea how to write unit tests for that part of it!  There's got to be a
 better way of implementing this part than using `glob()` but I couldn't
 think of it off the top of my head.

 Unfortunately, my dev environment is incapable of generating thumbnails
 for PDF uploads, so I can't test whether the patch causes problems with
 the fix in #39875.

 I'd also note that with this patch applied my `attachment_url_to_postid`
 filter correctly resolves attachment IDs for URLs for intermediate sized
 images (provided the attachment was uploaded after the patch is applied).

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


More information about the wp-trac mailing list