[wp-trac] [WordPress Trac] #47296: Attachments with very long filenames fail to save to the database

WordPress Trac noreply at wordpress.org
Sun Apr 12 16:20:47 UTC 2020


#47296: Attachments with very long filenames fail to save to the database
--------------------------+------------------------------
 Reporter:  mboynes       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Upload        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by brunochartier):

 This is due to the GUID column being VARCHAR(255) and for some reason WP
 is storing the full generated URL of an uploaded/imported media file in
 the GUID column.

 For example, if you upload a new media file named `01234567890.jpg`, WP
 stores the following in the GUID column: `https://<domain>/wp-
 content/uploads/<somepath>/01234567890.jpg`.

 Ideally, the GUID column should NOT be used to store a URL but rather a
 unique ID for which 255 chars is ample enough. I suggest to refactor the
 Media/Attachment to use a different field than GUID and with a size above
 255  chars (post_content column?).

 This problems causes even more issues for example with the plugin External
 Media Without Import which, for compatibility and consistency stores the
 URL of the external media also in the GUID. It is often the case to find
 HTTP URLs that go beyond 255 chars. Refactoring how the media URL is
 stored and removing the 255 limit would help expand the use of external
 media via long URLs.

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


More information about the wp-trac mailing list