How to restrict special characters for asset filenames in AEM DAM

Avatar

Avatar
Validate 1
Level 1
annyreddy
Level 1

Like

1 like

Total Posts

19 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
annyreddy
Level 1

Like

1 like

Total Posts

19 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
annyreddy
Level 1

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
Springboard
Level 7
KiranVedantam1992
Level 7

Likes

195 likes

Total Posts

213 posts

Correct reply

60 solutions
Top badges earned
Springboard
Give Back 5
Ignite 1
Affirm 50
Validate 1
View profile

Avatar
Springboard
Level 7
KiranVedantam1992
Level 7

Likes

195 likes

Total Posts

213 posts

Correct reply

60 solutions
Top badges earned
Springboard
Give Back 5
Ignite 1
Affirm 50
Validate 1
View profile
KiranVedantam1992
Level 7

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
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
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
Boost 250
MVP
ChitraMadan
MVP

Likes

273 likes

Total Posts

165 posts

Correct reply

67 solutions
Top badges earned
Boost 250
Establish
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Boost 250
MVP
ChitraMadan
MVP

Likes

273 likes

Total Posts

165 posts

Correct reply

67 solutions
Top badges earned
Boost 250
Establish
Ignite 1
Give Back 5
Give Back 3
View profile
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
Validate 10
MVP
kunal23
MVP

Likes

166 likes

Total Posts

565 posts

Correct reply

173 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 10
MVP
kunal23
MVP

Likes

166 likes

Total Posts

565 posts

Correct reply

173 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 50
View profile
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...