extension of illegal characters in file upload.js | Community
Skip to main content
Level 2
January 18, 2022
Solved

extension of illegal characters in file upload.js

  • January 18, 2022
  • 3 replies
  • 2111 views

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,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anmol_Bhardwaj

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.

 

3 replies

Anmol_Bhardwaj
Community Advisor
Anmol_BhardwajCommunity AdvisorAccepted solution
Community Advisor
January 18, 2022

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.

 

Varun_Shakya
Community Advisor
Community Advisor
January 18, 2022

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

Varun_Shakya
Community Advisor
Community Advisor
January 18, 2022

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

 

It should work ..please check

Level 2
January 18, 2022

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

milind_bachani
Adobe Employee
Adobe Employee
January 18, 2022

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.