[Rt-commit] rt branch, 4.0/alert-invalid-file-inputs, updated. rt-4.0.0rc4-63-g00b00aa

? sunnavy sunnavy at bestpractical.com
Wed Mar 2 05:01:18 EST 2011


The branch, 4.0/alert-invalid-file-inputs has been updated
       via  00b00aa57863d9f2b6f784f26abb08bcaafc3ecc (commit)
      from  0ee6ad45c8fc42217d30b515e87bab8c56842416 (commit)

Summary of changes:
 share/html/Elements/HeaderJavascript |    9 +++++++++
 share/html/NoAuth/js/util.js         |    9 +++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 00b00aa57863d9f2b6f784f26abb08bcaafc3ecc
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 2 18:00:35 2011 +0800

    CGI, HTTP::Body and MIME::Entity do *not* support double quotes in filenames,let's warn users for this. see also #16119

diff --git a/share/html/Elements/HeaderJavascript b/share/html/Elements/HeaderJavascript
index bc507dc..bbc846c 100644
--- a/share/html/Elements/HeaderJavascript
+++ b/share/html/Elements/HeaderJavascript
@@ -69,6 +69,15 @@ $onload => undef
 % if ( RT->Config->Get('MessageBoxRichText',  $session{'CurrentUser'})) {
     jQuery().ready(function ()  { ReplaceAllTextareas('<%$m->request_args->{'CKeditorEncoded'} || 0 %>') });
 % }
+
+
+jQuery( function() {
+    jQuery("input[type=file]").change( function() {
+            checkFileInput(this); 
+        } );
+    }
+);
+
 --></script>
 
 <%INIT>
diff --git a/share/html/NoAuth/js/util.js b/share/html/NoAuth/js/util.js
index 58855a6..82fe409 100644
--- a/share/html/NoAuth/js/util.js
+++ b/share/html/NoAuth/js/util.js
@@ -345,3 +345,12 @@ function addprincipal_onchange(ev, ui) {
 function escapeCssSelector(str) {
     return str.replace(/([^A-Za-z0-9_-])/g,'\\$1');
 }
+
+function checkFileInput ( element ) {
+    var val = jQuery(element).val();
+    if ( val && val.match( /"/ ) ) {
+        alert("filename contains double quote(\"), which is not supported");
+        jQuery(element).val('');
+    }
+}
+

-----------------------------------------------------------------------


More information about the Rt-commit mailing list