Insert a root album into all Sones to get rid of album manipulation in the Sone.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / CreateAlbumPage.java
index 95ca0da..9e9cd9e 100644 (file)
@@ -64,6 +64,9 @@ public class CreateAlbumPage extends SoneTemplatePage {
                        Sone currentSone = getCurrentSone(request.getToadletContext());
                        String parentId = request.getHttpRequest().getPartAsStringFailsafe("parent", 36);
                        Album parent = webInterface.getCore().getAlbum(parentId, false);
+                       if (parentId.equals("")) {
+                               parent = currentSone.getRootAlbum();
+                       }
                        Album album = webInterface.getCore().createAlbum(currentSone, parent);
                        album.setTitle(name).setDescription(TextFilter.filter(request.getHttpRequest().getHeader("host"), description));
                        webInterface.getCore().touchConfiguration();