Author: jfthomps
Date: Fri Mar 16 01:34:26 2012
New Revision: 1301307

URL: http://svn.apache.org/viewvc?rev=1301307&view=rev
Log:
VCL-521
An OS image named in japanese 2byte characters doesn't run

updated processImageInput - added checks for single and double quotes in image 
name, also added checks for 2byte characters in image name - generate error if 
name contains them

this was from a patch submitted by Toru Yokoyama

Modified:
    incubator/vcl/trunk/web/.ht-inc/images.php

Modified: incubator/vcl/trunk/web/.ht-inc/images.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/images.php?rev=1301307&r1=1301306&r2=1301307&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/images.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/images.php Fri Mar 16 01:34:26 2012
@@ -3067,12 +3067,17 @@ function processImageInput($checks=1) {
                return $return;
        }
        
-       if(preg_match('/-/', $return["prettyname"]) ||
+       if(preg_match("/[-'\"]/", $return["prettyname"]) ||
                strlen($return["prettyname"]) > 60 || 
strlen($return["prettyname"]) < 2) {
           $submitErr |= PRETTYNAMEERR;
           $submitErrMsg[PRETTYNAMEERR] = "Name must be from 2 to 60 characters 
"
-                                            . "and cannot contain any dashes 
(-).";
+                                            . "and cannot contain any dashes 
(-), single (') or double (\") quotes.";
        }
+       elseif(! preg_match('/^[\x20-\x7E]+$/', $return["prettyname"])) {
+               $submitErr |= PRETTYNAMEERR;
+               $submitErrMsg[PRETTYNAMEERR] = "Name can only contain 
alphabets, numbers, signs, and spaces.";
+       }
+
        if(! ($submitErr & PRETTYNAMEERR) &&
           checkForImageName($return["prettyname"], "long", 
$return["imageid"])) {
           $submitErr |= PRETTYNAMEERR;


Reply via email to