From 67e9ffb9fdbb132be8977943632b65154d696e14 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 1 Feb 2024 16:26:47 +0000 Subject: [PATCH] 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 --- src/js/media/views/attachment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/media/views/attachment.js b/src/js/media/views/attachment.js index a85b381c70..6f9f7f5001 100644 --- a/src/js/media/views/attachment.js +++ b/src/js/media/views/attachment.js @@ -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; }