Merge branch 'release/0.9-rc1'
[Sone.git] / src / main / java / net / pterodactylus / sone / web / EditImagePage.java
index 0b5f702..178add1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - EditImagePage.java - Copyright © 2010–2012 David Roden
+ * Sone - EditImagePage.java - Copyright © 2010–2013 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -71,10 +71,9 @@ public class EditImagePage extends SoneTemplatePage {
                                String title = request.getHttpRequest().getPartAsStringFailsafe("title", 100).trim();
                                String description = request.getHttpRequest().getPartAsStringFailsafe("description", 1024).trim();
                                if (title.length() == 0) {
-                                       templateContext.set("titleMissing", true);
+                                       throw new RedirectException("emptyImageTitle.html");
                                }
-                               image.setTitle(title);
-                               image.setDescription(TextFilter.filter(request.getHttpRequest().getHeader("host"), description));
+                               image.modify().setTitle(title).setDescription(TextFilter.filter(request.getHttpRequest().getHeader("host"), description)).update();
                        }
                        webInterface.getCore().touchConfiguration();
                        throw new RedirectException(returnPage);