How to restrict special characters for asset filenames in AEM DAM

Avatar

Avatar

annyreddy

Avatar

annyreddy

annyreddy

24-01-2021

Hi All,

If anyone implement or have idea on restricting special chanracters for filenames for assets Please let me know. Business users sometimes uploading files with special characters with asset files using touch UI and they are creating some issues. I wanted to to restrict such kind of situations.

 

I did some analysis on fileupload.js to restrict some characters but for some reason it is not working as I expected.

 

If any thoughts or suggestions on this implementation really help me.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

KiranVedantam1992

Avatar

KiranVedantam1992

KiranVedantam1992

24-01-2021

Hi @annyreddy,

 

As you already know that the assets are uploaded in /content/dam. Hence, we can use the Event handling approach.

 

  1. Write an event listener/workflow/schedulers to listen to the event [node added/ removed etc.] of uploading the assets at the particular content path
  2. Fetch the file name and check for special characters
  3. Replace them with the characters which are generic, then save the node

You can refer to my post on different annotations here.

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

Answers (3)

Answers (3)

Avatar

Avatar

BrianKasingli

MVP

Avatar

BrianKasingli

MVP

BrianKasingli
MVP

25-01-2021

@annyreddy,

You can configure the Day CQ DAM Asset Upload Restriction service from the OSGI console http://localhost:4502/system/console/configMgr/com.day.cq.dam.core.impl.mimeType.AssetUploadRestrict...

 

To restrict users to upload files of certain MIME types only, unselect the allow all MIME option and specify allowed MIME types in the Allowed Asset MIMEs (regex) fields using regular expressions.

Screenshot 2021-01-25 at 09.45.58.png

 

 

Avatar

Avatar

ChitraMadan

MVP

Avatar

ChitraMadan

MVP

ChitraMadan
MVP

25-01-2021

Hi @annyreddy ,

 

You can also overlay the js file which is responsible for doing the validation and add your special characters in the list.

Please refer to this - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/extending-file-name-valida...

Avatar

Avatar

kunal23

MVP

Avatar

kunal23

MVP

kunal23
MVP

24-01-2021

You can write a request filter to validate the asset before it gets uploaded in AEM. 

 

You can find a sample of that filter here - http://experience-aem.blogspot.com/2018/11/aem-6420-file-decode-filter-virus-scan-to-decode-uploaded...