From e948402dc6a3dc0139525cb60199c480f2313876 Mon Sep 17 00:00:00 2001 From: Andrea Stagi Date: Mon, 27 Feb 2023 10:51:16 +0100 Subject: [PATCH] fix: add message for special chars on file uploads --- inc/vendor/CMB2/includes/types/CMB2_Type_File_Base.php | 5 +++-- template-parts/documento/file.php | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/vendor/CMB2/includes/types/CMB2_Type_File_Base.php b/inc/vendor/CMB2/includes/types/CMB2_Type_File_Base.php index 375681694..48080cc3d 100644 --- a/inc/vendor/CMB2/includes/types/CMB2_Type_File_Base.php +++ b/inc/vendor/CMB2/includes/types/CMB2_Type_File_Base.php @@ -74,7 +74,7 @@ public function img_status_output( $args ) { * @return string File wrap output */ public function file_status_output( $args ) { - return sprintf( '<%1$s class="file-status cmb2-media-item">%2$s %3$s   (%5$s / %7$s)%8$s', + return sprintf( '<%1$s class="file-status cmb2-media-item">%2$s %3$s %9$s   (%5$s / %7$s)%8$s', $args['tag'], esc_html( $this->_text( 'file_text', esc_html__( 'File:', 'cmb2' ) ) ), esc_html( CMB2_Utils::get_file_name_from_path( $args['value'] ) ), @@ -82,7 +82,8 @@ public function file_status_output( $args ) { esc_html( $this->_text( 'file_download_text', esc_html__( 'Download', 'cmb2' ) ) ), isset( $args['cached_id'] ) ? ' rel="' . esc_attr( $args['cached_id'] ) . '"' : '', esc_html( $this->_text( 'remove_text', esc_html__( 'Remove', 'cmb2' ) ) ), - isset( $args['id_input'] ) ? $args['id_input'] : '' + isset( $args['id_input'] ) ? $args['id_input'] : '', + esc_url( $args['value'] ) != $args['value'] ? "(⚠️ Il file caricato contiene caratteri non ammessi, rimuovere il file e caricarlo con un altro nome)" : "" ); } diff --git a/template-parts/documento/file.php b/template-parts/documento/file.php index 5842156fa..c864c879f 100755 --- a/template-parts/documento/file.php +++ b/template-parts/documento/file.php @@ -15,7 +15,6 @@ $attach = get_post($idfile); $filetocheck = get_attached_file($idfile); - $filesize = filesize($filetocheck); $fulltype = mime_content_type($filetocheck); $arrtype = explode("/", $fulltype); @@ -37,7 +36,7 @@
-

+

- kb