diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/juick/server/util/ImageUtils.java | 2 | ||||
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 9 | ||||
-rw-r--r-- | src/test/resources/2936611-57.jpg | bin | 0 -> 101818 bytes |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/com/juick/server/util/ImageUtils.java b/src/main/java/com/juick/server/util/ImageUtils.java index d16faf8f..2f5d3292 100644 --- a/src/main/java/com/juick/server/util/ImageUtils.java +++ b/src/main/java/com/juick/server/util/ImageUtils.java @@ -108,7 +108,7 @@ public class ImageUtils { } } } - } catch (ImageReadException e) { + } catch (ImageReadException | IOException e) { // failed to read metadata. // nothing to do here, return image as is. } diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index c8f07d06..a0d10988 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -215,6 +215,8 @@ public class ServerTests { private Resource hubzillaFollow; @Value("classpath:announce.json") private Resource noteWithDocument; + @Value("classpath:2936611-57.jpg") + private Resource jpegNoJfifTiff; @Inject private KeystoreManager testKeystoreManager; @@ -1177,6 +1179,13 @@ public class ServerTests { assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getHeight(), is(1280)); assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getMedium().getHeight(), is(1024)); assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getSmall().getHeight(), is(512)); + CommandResult postNojfifTiff = commandsManager.processCommand(ugnich, "YO2", jpegNoJfifTiff.getURI()); + assertThat(postNojfifTiff.getNewMessage().isPresent(), is(true)); + int mid2 = postNojfifTiff.getNewMessage().get().getMid(); + File originalFile2 = Paths.get(imgDir, "p", String.format("%d.jpg", mid2)).toFile(); + assertThat(originalFile2.exists(), is(true)); + File mediumFile2 = Paths.get(imgDir, "photos-1024", String.format("%d.jpg", mid2)).toFile(); + assertThat(mediumFile2.exists(), is(true)); } @Test public void changeExtensionWhenReceiveFileWithWrongContentType() throws Exception { diff --git a/src/test/resources/2936611-57.jpg b/src/test/resources/2936611-57.jpg Binary files differnew file mode 100644 index 00000000..af4f9c91 --- /dev/null +++ b/src/test/resources/2936611-57.jpg |