[wp-trac] [WordPress Trac] #57957: Media title falsely has kebab case when inserted via REST API (e.g. in Block Editor)
WordPress Trac
noreply at wordpress.org
Mon Mar 20 15:15:49 UTC 2023
#57957: Media title falsely has kebab case when inserted via REST API (e.g. in
Block Editor)
--------------------------+-----------------------------
Reporter: abitofmind | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 6.1.1
Severity: major | Keywords:
Focuses: |
--------------------------+-----------------------------
== Reproduction I: "Upload New Media" creates media title "My Great Photo"
1) Media > Add New
2) Drag-n-drop "My Great Photo.jpg"
3) Inspecting this in "Edit Media" shows a media title "My Great Photo".
== Reproduction II: Insertion via Block Editor (Gutenberg) creates media
title "My-Super-Photo"
1) Edit an existing page or create a new page.
2) Set the cursor into an empty block.
3) Drag-n-drop "My Super Photo.jpg" into this block. This automatically
creates a media page behind the scenes.
4) Save the page.
5) Inspecting the media title via "Edit Media"
- **Actual:** The media title is "My-Super-Photo".
- **Expected:** The media title should be "My Super Photo".
- The media title should be the filename portion (without the suffix) in
its purest possible form (UTF-8) and only the slug and filename should
then be transformed according settings regarding
ascii/whitespace/transliteration/escaping/punycode/etc.
- Achieving the same goal via different means (Upload New Media vs.
drag-n-drop in editor) should result in the same outcome. Otherwise this
is an inconsistency.
== Analysis & Fix
@adamsilverstein already analyzed and fixed this bug in the Gutenberg
issue tracker and asked to re-file here in WordPress Core for review &
adding to the codebase.
=== Adam's Analysis
> This is actually something that happens on the core side where the logic
to set the title is currently different in the REST API vs. the regular
media uploader.
=== Adam's Fix which should be reviewed
> I proposed a fix in [https://github.com/WordPress/wordpress-
develop/pull/3981 WordPress/wordpress-develop #3981] that works in my
testing. Would be good to have some additional feedback, maybe from the
REST API team.
=== Environment
- First [https://github.com/WordPress/gutenberg/issues/34149 reported on
2021-08-19] in WordPress v5.8 ,
[https://github.com/WordPress/gutenberg/issues/34149#issuecomment-1416260545
confirmed/patched in 2023-02 ] on a WordPress v6.1.1 instance.
=== Priority
- If the fix is deemed solid and the review process goes quickly without
bumps: Is there a chance that the fix can make it into the 6.2 release? If
not, no worry, am happy whenever this will get eventually fixed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57957>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list