[MGNLDAM-847] damfn.getAsset is not working with files uploaded in ZIPs Created: 17/Apr/20  Updated: 22/May/20  Resolved: 20/May/20

Status: Closed
Project: Magnolia DAM Module
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.2

Type: Bug Priority: Neutral
Reporter: Bartosz Staryga Assignee: Adam Siska
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: 1h
Time Spent: 4m
Original Estimate: Not Specified

Attachments: File Screen Recording 2020-04-17 at 13.25.24.mp4     File Screen Recording 2020-04-20 at 09.20.48.mp4     PNG File Screenshot 2020-04-20 at 07.14.30.png    
Issue Links:
Relates
relates to MGNLDAM-843 Whitespaces are not sanitized when up... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: Migrate apps to new UI framework
Sprint: UI FW 2
Story Points: 5

 Description   

Steps to reproduce

  • Upload assets as ZIP-archive
  • Use
     {{[#assign asset = damfn.getAsset(content.imageLink)!]
  • Add image to component

Expected results

  • Asset loads normally on the templates

Actual results

  • Image does not load on page editor, nor can it be reached individually

Workaround

  • no workaround

Development notes

  • Does not work with sanitized (no whitespaces) filenames either (MGNLDAM-843)
  • This does not work (getAsset):
    [#assign asset = damfn.getAsset(content.imageLink)!]
  • This does work (getRendition, it is used in travel):
    [#assign asset = damfn.getRendition(content.imageLink, "original")!]
  • So somehow what damfn.getAsset returns is not working with zipped files.
  • getAsset works well for assets that were uploaded directly (not through zip-files)
  • Probably related to extension being added at the end when uploading from zip


 Comments   
Comment by Tomáš Gregovský [ 17/Apr/20 ]

well for the video with zip… in 5.7 if I have image.jpg and I will zip it to image.zip and them upload zip to dam… it will create “image” folder (based on name of zip file) with image.jpg inside … already this doesn’t seems to be thing in 6.2 by attached video…

Comment by Richard Gange [ 17/Apr/20 ]

Is it possible the space is causing an issue?

Comment by Simon Lutz [ 20/Apr/20 ]

tgregovsky - your findings are covered here: MGNLDAM-823 - zip-upload of 6.2 behaves as 'extract to here'.

bstaryga - I tried to reproduce it - I think the issue is that the ZIP-upload is not properly sanitizing whitespaces. It fails for me when I use a whitespace in the filename (' - copy') and works well without whitespaces. Could you double-check?

Whitespaces are properly sanitized for a regular upload (w/o zip).

Red: uploaded as zip (includes whitespaces still / does not work)
Green: direct upload as jpeg (whitespaces replaces with dashes / works)

Comment by Bartosz Staryga [ 20/Apr/20 ]

slutz rgange i tried and space or not, same issue happens.
Screen Recording 2020-04-20 at 09.20.48.mp4

slutz try to use the uploaded image in some template. They do appear all right in the asset picker but when used in template they are not working.

Comment by Simon Lutz [ 20/Apr/20 ]

The sanitizing of whitespaces was what made them working or failing in my tests. I used travel demo templates though, so maybe you're facing something else. Could you try using these images in a text&image component on travel/about?

Comment by Bartosz Staryga [ 20/Apr/20 ]

slutz I did tried with travel and you are right, it worked.
So it had to be something in ftls and what I can see:

This does not work (what I have)

[#assign asset = damfn.getAsset(content.imageLink)!]

 

This does not work (it is used in travel)

[#assign asset = damfn.getRendition(content.imageLink, "original")!]

And then using in ftl asset.link.

So somehow what damfn.getAsset returns is not working with zipped files.
So still an issue as pretty much all ftls I have seen use getAsset not getRendition

 

Comment by Simon Lutz [ 20/Apr/20 ]

Thanks bstaryga - I changed description of this ticket and created MGNLDAM-843 for the whitespaces.

Generated at Mon Feb 12 05:03:52 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.