Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

extension of illegal characters in file upload.js

Avatar

Level 2

Hi Team, 

 

I am trying to extend the fileupload.js functionality. There are few more special characters like 'à','ç' (continuous pressing of 'A'/'C' in the keyboard will popup these values). So how can I restrict those values ?

 

 

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi @Shetty1191 ,

 

To achieve this, we would need to overlay the fileupload.js in : /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js

 

After overlaying that in apps, you would need to:

Add the values/characters which you need to restrict in the _ILLEGAL_FILENAME_CHARS variable (separate them with ,) on line103. - This is the variable which takes care of all the restricted words. 

 

I think the DamFileUpload and DamFolderUpload both use this same variable.

 

View solution in original post

6 Replies

Avatar

Correct answer by
Level 7

Hi @Shetty1191 ,

 

To achieve this, we would need to overlay the fileupload.js in : /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js

 

After overlaying that in apps, you would need to:

Add the values/characters which you need to restrict in the _ILLEGAL_FILENAME_CHARS variable (separate them with ,) on line103. - This is the variable which takes care of all the restricted words. 

 

I think the DamFileUpload and DamFolderUpload both use this same variable.

 

Avatar

Community Advisor

give the complete file path which u are trying to overlay ..and what u want to restrict

Avatar

Community Advisor

ILLEGAL_FILENAME_CHARS: ['*', '/', ':', '[', '\\', ']', '|', '#', '%','{','}','?', '&','à','ç'],

 

It should work ..please check

Avatar

Level 2

It is possible to give a regex pattern to it instead of adding all the characters ?

Avatar

Community Advisor

Hi @Shetty1191 ,

Please try using the following regex, it covers almost all accented characters:

^[\u00C0-\u00FF]*$

Add this regex to ILLEGAL_FILENAME_CHARS to disallow the accented characters to be used in filename.

 

Thanks.