Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Why can't I add a specific path in a filter.xml file?

Avatar

Level 5

Hello, what happens is that I am following the guide of:

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-modify-a-crxde-file...


To modify a just a file called fileupload.js that is in charge of validating information and uploading the asset in AEM using DAM.


What happens is that I am in the final step where only remains to add the path of the file that I created in filter.xml.


But when I add the complete path that would be the following one:


/apps/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js


I get the following error:


is not covered by any of the specified dependencies nor a valid root


But when I add the path in short version it allows me to do the following:


/apps/dam

Aaron_Dempwolff_1-1695223063601.png


But when I do the DAM when I click on create to upload an asset, the button does not work anymore.

Aaron_Dempwolff_0-1695223023415.png


What can I do in this case?, I already try to add the differents mode (replace, merge and update) and add the complete path but nothing of this works.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Aaron_Dempwolff 

 

I guess this is related to another thread to avoid space in filename.

 

There is a correction to the solution. As per the latest code from AEM SDK, the filename validation in Coral UI is done via

 

Filename: /libs/dam/gui/coral/components/admin/clientlibs/damutil/js/util.js

Function: getInvalidFileChars()

 

We just need to overlay this js in /apps

 

Update the function to:

    function getInvalidFileChars() {
        return [ "*", "/", ":", "[", "\\", "]", "|", "#", "%", "{", "}", "?", "&" , " "];
    }

 

And it should work. Apologies I had shared earlier answer based on my past experience. But there seems to have been an update.

 

I have tried the solution from current thread. It will stop user from uploading file with space

aanchalsikka_0-1695265485776.png

 


Aanchal Sikka

View solution in original post

13 Replies

Avatar

Community Advisor

Hello @Aaron_Dempwolff 

 

You would need to declare the parent paths in pom.xml of ui.apps.structure module. Example

 

                        <filter><root>/apps/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js</root></filter>
                        <filter><root>/apps/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/</root></filter>
                        <filter><root>/apps/dam/gui/coral/components/commons/fileupload/clientlibs/</root></filter>

 

Please check till which parent level you need to declare explicitly.

 

The validator is trying to make sure that we do not deploy a child node, without a parent node:

- Being available in AEM

- Being deployed via code.

 

Also, please make sure that if we are creating any parent node via code, it should have proper jcr:primaryType, else we might run into issues later.


Aanchal Sikka

Avatar

Level 5

I try you solution but still giving me the same error when I add the complete path in the filter.xml file, I tried with the paths that you gave me and even try a bunch of paths with / at the end or without it.

Aaron_Dempwolff_0-1695224735873.png

 

Avatar

Community Advisor

@Aaron_Dempwolff 

 

Have to tried deploying ui.apps after ui.apps.structure. Or just ui.apps?


Aanchal Sikka

Avatar

Level 5

I'm working on local first, I run the command mvn clean install -PautoInstallPackage to build the project

So first build the ui.apps folder then the ui.apps.structure folder.

Is necessary to add the same path in the pom.xml of ui.apps?

Avatar

Community Advisor

Hello @Aaron_Dempwolff,

 

To add with @aanchal-sikka, make sure you have all your filter(s) inside a parent tag filters:

 

<filters>
        <filter><root>/apps/{project-name}</root></filter>
        <filter><root>....</root></filter>
        <filter><root>....</root></filter>
</filters>

  Thanks

Avatar

Level 5

Yes, this is something I forgot to add, but even adding it still doesn't work.

Avatar

Community Advisor

Hello @Aaron_Dempwolff,

 

I think you placed the filters in the wrong place, it should be under build configuration in the pom.xml under  your ui.apps.structure module as follow:

 

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.jackrabbit</groupId>
                <artifactId>filevault-package-maven-plugin</artifactId>
                <configuration>
                    <properties>
                        <cloudManagerTarget>none</cloudManagerTarget>
                    </properties>
                    <filters>
                      <filter><root>/apps/{project-name}</root></filter>
                      <filter><root>....</root></filter>
                      <filter><root>....</root></filter>
                    </filters>
                </configuration>
            </plugin>
        </plugins>
    </build>

 

Avatar

Level 5

Yes, I have that format but doesn't works, this is the pom.xml file

Aaron_Dempwolff_0-1695241928511.png



And this is the filter.xml file:

Aaron_Dempwolff_1-1695241946585.png

 

By adding the path on filter.xml throws and error

Avatar

Level 5

Update: Now I can build the project, only I need to delete the cache with the command:

mvn clean.

 

But my changes don't show it when the asset is uploaded on DAM, is necessary to do something else to make my changes work?

Avatar

Correct answer by
Community Advisor

Hello @Aaron_Dempwolff 

 

I guess this is related to another thread to avoid space in filename.

 

There is a correction to the solution. As per the latest code from AEM SDK, the filename validation in Coral UI is done via

 

Filename: /libs/dam/gui/coral/components/admin/clientlibs/damutil/js/util.js

Function: getInvalidFileChars()

 

We just need to overlay this js in /apps

 

Update the function to:

    function getInvalidFileChars() {
        return [ "*", "/", ":", "[", "\\", "]", "|", "#", "%", "{", "}", "?", "&" , " "];
    }

 

And it should work. Apologies I had shared earlier answer based on my past experience. But there seems to have been an update.

 

I have tried the solution from current thread. It will stop user from uploading file with space

aanchalsikka_0-1695265485776.png

 


Aanchal Sikka

Avatar

Level 5

Thank you, with this solution that you gave me it worked.

I have one more question, do you know if in this same file it is possible to change the characters of the image when uploaded in DAM?

For example I can already launch the warning when it contains space and doesn't let upload it, but if you upload an asset that contains the + character (for example: my+asset.jpg) when the user clicks on the upload button or before the upload button appears, the name will remove the +, leaving myasset.jpg as the result.

Avatar

Community Advisor

Hello @Aaron_Dempwolff 

 

I will check and get back to you. Meanwhile, can you possibly create a separate thread, because the requirement is different?

 

Seperate thread help people search for questions and corresponding answers in an easier manner.


Aanchal Sikka