From 26a70cfd049aa909eea238aa2e525ecd0b314140 Mon Sep 17 00:00:00 2001 From: abhishek kumar Date: Sat, 31 Oct 2026 01:42:21 +0530 Subject: [PATCH] Media: Avoid showing the filename twice for upload size errors. The media upload status error template already shows the filename next to each message, but `wp.Uploader.errorMap.FILE_SIZE_ERROR` also inserted the filename into its message, so size errors in the media grid and modal named the file twice. Add a `file_size_exceeded` string to `pluploadL10n` that does not include the filename and use it for `FILE_SIZE_ERROR`. The shared template is unchanged, so other upload errors keep their filename and messages remain escaped. See #64931. --- src/js/_enqueues/vendor/plupload/wp-plupload.js | 4 ++-- src/wp-includes/script-loader.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/vendor/plupload/wp-plupload.js b/src/js/_enqueues/vendor/plupload/wp-plupload.js index c0eb570657bf4..43a35a335d765 100644 --- a/src/js/_enqueues/vendor/plupload/wp-plupload.js +++ b/src/js/_enqueues/vendor/plupload/wp-plupload.js @@ -480,8 +480,8 @@ window.wp = window.wp || {}; 'IO_ERROR': pluploadL10n.io_error, 'SECURITY_ERROR': pluploadL10n.security_error, - 'FILE_SIZE_ERROR': function( file ) { - return pluploadL10n.file_exceeds_size_limit.replace( '%s', file.name ); + 'FILE_SIZE_ERROR': function() { + return pluploadL10n.file_size_exceeded; }, 'HTTP_ERROR': function( file ) { diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 56acc94dbbe00..2e8b010ab9b34 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -993,6 +993,7 @@ function wp_default_scripts( $scripts ) { 'queue_limit_exceeded' => __( 'You have attempted to queue too many files.' ), /* translators: %s: File name. */ 'file_exceeds_size_limit' => __( '%s exceeds the maximum upload size for this site.' ), + 'file_size_exceeded' => __( 'This file exceeds the maximum upload size for this site.' ), 'zero_byte_file' => __( 'This file is empty. Please try another.' ), 'invalid_filetype' => __( 'This file cannot be processed by the web server.' ), 'not_an_image' => __( 'This file is not an image. Please try another.' ),