asset-share-commons icon indicating copy to clipboard operation
asset-share-commons copied to clipboard

How to revive legacy "flatStructure" download

Open zhgeric opened this issue 1 year ago • 8 comments

Question?

  • What piece of functionality do you have a question about? About the asset download functionality
  • What are you trying to achieve? What should I do to prevents the creation of additional folder that wraps my assets in my zip file while downloading ? Like in the legacy mode "flatStructure"

zhgeric avatar Oct 26 '24 00:10 zhgeric

I think we'll have to add a toggle to the dialog that lets you force a flat structure and check that on like 118 here:

https://github.com/adobe/asset-share-commons/blob/develop/core.cloud/src/main/java/com/adobe/aem/commons/assetshare/content/renditions/download/async/impl/AsyncAssetRenditionsDownloadServlet.java

I'm not sure what would happen if you have 2 assets w the same file name tho (but in different assets folders)

davidjgonzalez avatar Oct 26 '24 00:10 davidjgonzalez

I don't really understand what to do here.

Do I need to force 118 to false ?

I tried doing that but the folder is still created

zhgeric avatar Oct 26 '24 15:10 zhgeric

Seems like my Post request is going to https://github.com/adobe/asset-share-commons/blob/develop/core/src/main/java/com/adobe/aem/commons/assetshare/content/renditions/download/impl/AssetRenditionsDownloadServlet.java and not the async one

zhgeric avatar Oct 26 '24 15:10 zhgeric

Are on on SDK? SDK doesn't have the AEM async download framework.

You'd have to develop against an RDE to dev/test against the async stuff

davidjgonzalez avatar Oct 26 '24 17:10 davidjgonzalez

Oh that's why ! I'm on a SDK on my local environment, I didn't know that there was a difference.

Mmh if I only wanted to custom this https://github.com/adobe/asset-share-commons/blob/develop/core/src/main/java/com/adobe/aem/commons/assetshare/content/renditions/download/impl/AssetRenditionsZipperImpl.java By extending to it and changing 97 to false ?

Would it work? And how should I do that? I tried a few things but my request doesn't seems to go in it.

zhgeric avatar Oct 26 '24 17:10 zhgeric

I may have succeded somehow, but that doesn't seem a clean way to do it.

https://github.com/adobe/asset-share-commons/blob/develop/core/src/main/java/com/adobe/aem/commons/assetshare/content/renditions/download/impl/AssetRenditionsDownloadServlet.java

https://github.com/adobe/asset-share-commons/blob/develop/core/src/main/java/com/adobe/aem/commons/assetshare/content/renditions/download/impl/AssetRenditionsZipperImpl.java

I took these both into my code and set it to false and that did the job mmh

zhgeric avatar Oct 26 '24 17:10 zhgeric

Ahh - yes, if you're going to run this on AEM as a cloud service you need to do it in the async. If your are running 6.5 the you'd do it on the old one.

davidjgonzalez avatar Oct 26 '24 18:10 davidjgonzalez

By the way, I was wondering "I'm not sure what would happen if you have 2 assets w the same file name tho (but in different assets folders)" what is happening right now when 2 assets w the same name is being downloaded ? The 2nd asset isn't downloaded ? if (folderName != null && !zipEntryFolderNames.contains(folderName)) { addFolderAsZipEntry(folderName + "/", zipOutputStream); zipEntryFolderNames.add(folderName); }

zhgeric avatar Oct 28 '24 11:10 zhgeric

Thinking about adding this into the main-line -- do you need this for AEM CS or 6.5?

davidjgonzalez avatar Oct 31 '24 21:10 davidjgonzalez

I'm using 6.5

zhgeric avatar Nov 01 '24 13:11 zhgeric