[MGNLSTK-1274] Colon in image filename breaks getAssetVariation Created: 08/Nov/13 Updated: 02/Jul/18 Resolved: 02/Jul/18 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | templates |
| Affects Version/s: | 2.0.12 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | David Pronk | Assignee: | Christopher Zimmermann |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | VPRO | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Testcase included: |
Yes
|
| Date of First Response: |
| Description |
|
When trying to resolve an asset variation for an uploaded image containing a colon ( : ) in the fileName, the link property in the result is null making it impossible to show the image. Underlying problem is that in the ImageOperationProvidingVariation is trying to put the (user created) fileName blindly in the java URI() class constructor causing a URISyntaxException and returning null from the createLink method. See the following commit: This is a regression from Magnolia 4.4 to 4.5 In the template we are using the following code to retrieve the link: stkfn.getAssetVariation(image, imageVariation).link JUnit testcase:
@Test
public void testCreateLinkWithInvalidURIChars(){
// GIVEN
Site site = mock(Site.class);
final ThemeReference themeRef = new ThemeReference();
themeRef.setName("myTheme");
when(site.getTheme()).thenReturn(themeRef);
Provider<Site> siteProvider = mock(Provider.class);
when(siteProvider.get()).thenReturn(site);
ImageOperationProvidingVariation imageOperationProvidingVariation = new ImageOperationProvidingVariation(siteProvider);
imageOperationProvidingVariation.setGeneratorName("generatorName");
imageOperationProvidingVariation.setName("name");
imageNode.setProperty(FileProperties.PROPERTY_FILENAME, "name with : and ยง");
// WHEN
String link = imageOperationProvidingVariation.createLink(imageProperty);
// THEN
assertEquals("http://localhost:9090/demoAuthor/.imaging/generatorName/myTheme/name/website/image/name%20with%20%3A%20and%20%C2%A7.jpg", link);
}
|
| Comments |
| Comment by Jan Haderka [ 02/Jul/18 ] |
|
STK have been deprecated in September 2017. As part of this project nearing end-of-life, we are not planning to fix any of the existing issues except for the critical security issues. For more details, please consult documentation. |