-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
2.0.12
-
-
Empty show more show less
-
Yes
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); }
Acceptance criteria