[wp-trac] [WordPress Trac] #39875: PDF previews overwrite existing images with the same name.

WordPress Trac noreply at wordpress.org
Sun Feb 26 08:28:03 UTC 2017


#39875: PDF previews overwrite existing images with the same name.
-------------------------------------+------------------------
 Reporter:  gitlost                  |       Owner:  joemcgill
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.7.3
Component:  Media                    |     Version:  4.7
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------

Comment (by gitlost):

 There's a typo in the patch - `'-pdf.pdf'` should be `'-pdf.jpg'`.

 Also why not the code as suggested in comment:8 above instead of a
 variation using `preg_replace()`? - which is non-semantic and doesn't seem
 to add anything and is worse in some (admittedly very) edge cases (and
 frankly is an anti-pattern whose use should be removed from core -
 `/var/www/my.wordpress/blah_noext` anyone?!).

 Also the unit test doesn't allow for the PDF marker, and the other tests
 aren't fixed to clean up properly after themselves.

 Following is a patch which just uses the change suggested in comment:8
 with `-pdf` instead of `_pdf`, and with the unit tests from
 [https://core.trac.wordpress.org/attachment/ticket/39875/39875.patch
 39875.patch], adjusted for `-pdf` and cleaned up a bit and with an extra
 renaming test.

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


More information about the wp-trac mailing list