[MGNLSTK-1214] stkTemplatingFunctions.getAssetLink() not consistently encoded Created: 24/Jul/13 Updated: 04/Dec/13 Resolved: 05/Sep/13 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | None |
| Affects Version/s: | 2.0.10 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Adrien Berthou | Assignee: | Robert Šiška |
| Resolution: | Obsolete | Votes: | 0 |
| Labels: | stk | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Magnolia 4.5.9 |
||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Patch included: |
Yes
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Description |
|
stkTemplatingFunctions.getAssetLink(Node content, String nodeDataPrefix) returns an encoded url when the data has been "selected from the DMS" via the dialog. However, it returns a non-encoded url when the data has been "uploaded" via the dialog. Solution: String nonEncodedUrlStringForAsset = "//localhost:8080/url/to/non/encoded/doc/my doc.pdf"; URI uri = new URI("http", nonEncodedUrlStringForAsset, null); URL url = uri.toURL(); |
| Comments |
| Comment by Adrien Berthou [ 24/Jul/13 ] |
|
To reproduce the bug: Then find out the value returned when the relevant method is called on the first file. |
| Comment by Ondrej Chytil [ 12/Aug/13 ] |
|
Hi Adrien, can you please specify your environment and possibly your encoding related settings? I just tried to reproduce the issue but both upload and DMS are returning properly encoded links. |
| Comment by Adrien Berthou [ 15/Aug/13 ] |
|
Hi Ondrej, Here is my environment: Where can I find my encoding related settings? More info regarding this issue, try doing: String firstAssetLink = stkTemplatingFunctions.getAssetLink(nodeOne, "pdf"); String secondAssetLink = stkTemplatingFunctions.getAssetLink(nodeTwo, "pdf"); log.info("firstAssetLink : " + firstAssetLink ); log.info("secondAssetLink : " + secondAssetLink ); Again, try this with a file having a space in its name. nodeOne's pdf having been uploaded & nodeTwo's pdf beeing in the DMS. You should then see the difference in the URLs. assetLink = URLDecoder.decode(assetLink, "UTF-8");
|
| Comment by Robert Šiška [ 05/Sep/13 ] |
|
Fixed by |