What would be the simplest approach to have aem 6.5 treat the various tif extension variations (tif tiff TIF and TIFF) as the same or convert them during upload? Ideally this would occur as a file is uploaded and would trigger the Naming Conflict popup if another file has the same name but a different tif extension (ex: filename.tif and filename.TIFF would be treated the same). My initial concept is to overlay the javascript here: /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js
and have it convert the extension of the various tif extensions to a single variation like .tif during the getDuplicates function. Any suggestions? Or is this the best approach?
Views
Replies
Total Likes
Hi @DNest19 ,
It's very edge and not usual case.
I would not recommend to override such crucial AEM js, because it might be updated in future. Try to find a way how to listen event for file adding before it's captured by fileupload component. Inject this code as a small clientlibrary before clientlibrary with fileupload.js.
Best regards,
Kostiantyn Diachenko.
Views
Replies
Total Likes
Would it be possible for this approach to still have the same "Name Conflict" dialog? Or would I essentially need to recreate the same client lib located at /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js for just tif files with my custom handling of extensions to have that same popup? How would I ensure that this clientlib handles the tif before the default clientlib at libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js ?
Views
Replies
Total Likes
Hi @DNest19 ,
I checked fielupload.js code and noticed that instance of DamFileUpload is created inside a function and not exposed. That's why you can't access it in separate clientlib. My idea was somehow to play around duplicateAssets property.
The only 1 remaining way to satisfy your requirements with relying on Name Conflict dialog is: create own clientlib, listen file adding, copy logic related to "duplicate handling" from fileupload.js and adapt it to your needs. The main thing that your listen has to be called before OOTB logic. Try to play around it.
Note, if you even recreate a clientlibrary, it won't work, because you will have to hide OOTB code. It can be possible only by changing clientlib category under /libs. It's strictly forbidden.
Best regards,
Kostiantyn Diachenko.
Views
Replies
Total Likes
Hi @DNest19,
You can try writing the java code which renames the file based on extension. For example: if the three files are
filename.tif
filename.tiff
filename.TIF
filename.TIFF
they can be renamed to (while uploading)
filename_tf.tif
filename_tff.tiff
filename_TF.TIF
filename_TFF.TIFF
Since, filenames in aem are case-sensitive, they will be considered different files.
Thanks
Views
Replies
Total Likes
I think you are misunderstanding. My client wants each of the different extensions to be treated the same so that there won't be repeated file names the issue is when we have two assets with the same name but different extension (of the same filetype). Example examplename.tif and examplename.tiff are treated as different filenames and we want them to be treated the same. We could of course use a workflow to change the tif extension during upload processing, but then we have to detect duplicate and manage them somehow. The goal would be to have the usual "Name Conflict" popup during upiload.
@DNest19 Did you find the suggestions helpful? If you need more information, please let us know. If a response resolved your issue, kindly mark it as correct to help others in the future. Alternatively, if you discovered a solution on your own, we'd appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
I will just be trying to overlay the javascript as that seems like the only viable solution unless someone else has an alternative.
Views
Replies
Total Likes
Yes, it's only one viable, but not the best solution. Check my comment above.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies