- if (title.isPresent() && !imageUrls.isEmpty()) {
- Comic comic = new Comic(title.get());
- int imageCounter = 0;
- for (String imageUrl : imageUrls) {
- String imageComment = (imageCounter < imageComments.size()) ? imageComments.get(imageCounter) : "";
- Strip strip = new Strip(imageUrl, imageComment);
+ if (imageUrls.isEmpty()) {
+ return new FailedState();
+ }
+
+ Comic comic = new Comic(title.or(""));
+ int imageCounter = 0;
+ for (String imageUrl : imageUrls) {
+ String imageComment = (imageCounter < imageComments.size()) ? imageComments.get(imageCounter) : "";
+ try {
+ URI stripUri = new URI(htmlState.uri()).resolve(imageUrl.replaceAll(" ", "%20"));
+ Strip strip = new Strip(stripUri.toString(), imageComment);