Don't send title during mediaUploads; Fix: Image Uploads don't use exif title #13193
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #13136
We are automatically computing the title based on the file name and we send it during media uploads.
If the rest API receives an explicit title like we are sending the explicitly sent title is used instead of an automatic computed one.
Our automatic title computation on the client is very simple and does not use EXIF metadata. While the title computation of the server uses EXIF metadata if it is present and if not it uses the filename following similar logic to what we did on the client.
I think we should remove the title computation from the client because of the following reasons:
If a plugin or a block wants a specific title to be used that is still possible, the title can be passed in additionalData object and in this case, the title will be used.
How has this been tested?
Test image:
I used drag & drop on the test image to upload it. I pressed edit button on the created image block and I verified on the media modal that the caption was "My caption" and the title was "My title".
I added an image block, and I upload the same image using the upload button and verified the correct title and caption were applied.
I repeated the same tests using media & text and cover block.
I used other blocks with uploads cover, video, audio, file, I upload some files and images without EXIF data and I checked a title was generated based on their name.