cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3002
Views
10
Helpful
10
Replies

Can not upload WAV file in UCCX

kbeaton
Level 1
Level 1

I'm trying to upload a WAV file "SRC+Neu+Emer.wav" that is 219 KB using "Cisco Unified CCX Administration\Prompt Management".

I keep getting a message "Special Characters like.....are not allowed in file name". The file name doesn't have any of the Special Characters listed.

I've also tried changing the name to "SRC Neu Emer.wav"

I deleted the file "SRC+Neu+Emer.wav" in Administration\Prompt Management

Even with the file deleted, I can't upload the file. I still get the same error message "Special Characters like.....are not allowed in file name"

I've dried this in three different browsers

I moved the files to my desktop, from the network.

 

I'm thinking I'm missing something obvious...

 

Any help would be appreciated!

 

Kelvin

10 Replies 10

Anthony Holloway
Cisco Employee
Cisco Employee

Duplicate Post Removed

Anthony Holloway
Cisco Employee
Cisco Employee

 

EDIT: Just in case this reply shows up twice, when I originally posted it, it went missing entirely.  So, I'm posting it again.  Thankfully, my browser back button enabled me to recover my reply content, else I would not have had the energy to write this all over again.

 

Summary: You cannot have spaces in the name.

 

To learn why, let's take a closer look at what's going on under the hood.  Let's use a filename with a space in the name: test prompt.wav

 

When you select a file on your computer, with the browse button, the browser exposes the filename to the javascript like this: C:\\fakepath\\test prompt.wav

 

In the code, it grabs a reference to this value with the following line of code:

var srcFile = document.FORM1.file1.value;

 

From here, the code tries to strip off the prefix with the fake path with this line of code, so that all we're left with is the filename itself: test prompt.wav 

srcFile = srcFile.substring(srcFile.lastIndexOf("\\")+1,srcFile.length);

 

Then, the code tries to normalize the data for transfer to the server, by running the filename through an encoder, like so: 

srcFile = encodeURIComponent(srcFile);

 

The details of the function encodeURIComponent are unimportant, but the outcome is.  The space in the filename gets converted to %20, the ASCII Hex value for the Space character.

 

So, at this point, our filename looks like this, to the code: test%20prompt.wav

 

Now, there's some other things going on in the code at this point, but they are not important for our understanding of why filenames with spaces in them are breaking your upload.  E.g., Trimming leading and trailing white space off the name.

 

Last but not least, the star of the show, the error message you are seeing is produced by the outcome of the following function call: 

isInvalidString(srcFile,filenameSplChars)

 

The details of this function, again, are unimportant, but the outcome is.  The results of this call are true, because the filename is compared against filenameSplChars, which holds the following value: 

"&%*?\"<>|'"

 

Notice anything familiar in there?  You may have noticed the percent sign (%) is in that list.  So, when this section of code in the function isInvalidString is ran, we return true for the percent sign (%)

for (var i = 0; i < mask.length; i++) {
      if (s.indexOf(mask.charAt(i)) > -1)
        return true;                       // a character was found that is not valid
}

 

And that's the story of how a Voice Engineer identified a Cisco software defect.  Either the alert message should contain the space character, or the code should check isInvalidString before running encodeURIComponent.

 

Well explained Anthony!!

Thank you!

Let me work on a serviceability defect which can improvise the error message for the future releases. Thanks for the detailed analysis!

 

Regards,

Arundeep

That would be fantastic. Thank you.

Well, we got more than expected, we convinced ourselves with a software defect - CSCvk64690 (visible on Bug Tool Kit once it passes security screening).

 

This would be fixed in 12.0 with a hypothesis that we will run the validator before we perform the encoding.

 

Isn't this music to your ears on a Friday, Anthony? ;)

 

Regards,

Arundeep

Very cool! Thank you for working on this in the background. Happy Friday!

Hi Anthony, has the file name criteria changed over time? The majority of the files already uploaded have spaces in the file names. I'm guessing at one time spaces were allowed.

Are Underscores allowed? I'd like to make the file names a little more readable.

Thanks for your input!

 

Kelvin

I really don't know if the parameters for acceptable file names have officially changed, but based on your experience, I would definitely argue that they've inadvertently changed (aka defects).

 

The function doing the encoding, encodeURIComponent, is a native Javascript function.

 

On the documentation page for the function, you can see that it will not encode the following ASCII characters:

A-Z a-z 0-9 - _ . ! ~ * ' ( )

 

Therefore, if we call the function with our test input, we can see that the output is unmodified (not encoded): 

>> encodeURIComponent("underscores_in_the_name.wav");
<- "underscores_in_the_name.wav"

 

As opposed to say a name with spaces: 

>> encodeURIComponent("spaces in the name.wav");
<- "spaces%20in%20the%20name.wav"

 

FYI, I was able to test this function in the my browser console.

 

I hope that helps.