Media: Prevent local edits during media upload.

Prevent `options.allowLocalEdits` from toggling to true during the upload cycle. Otherwise, media meta fields can be edited, but the data will be lost as soon as the upload process is completed.

Props codepo8, oglekler, nicolefurlan, antpb, syamraj24, joedolson.
Fixes #58783, #23374.

git-svn-id: https://develop.svn.wordpress.org/trunk@57515 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson 2024-02-01 16:26:47 +00:00
parent 1e564ad6c0
commit 67e9ffb9fd

View File

@ -120,7 +120,7 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
options.can.save = !! options.nonces.update;
}
if ( this.controller.state().get('allowLocalEdits') ) {
if ( this.controller.state().get('allowLocalEdits') && ! options.uploading ) {
options.allowLocalEdits = true;
}