X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FCreateAlbumPage.java;h=a8d024a8d69bc78b7bb39c8c88db0f50aa986287;hb=f4f5fb752ff9aff0235a907e170c6961576562f6;hp=9072ea48b192a4b850ca42dc186ad98c83cb9007;hpb=0ebf4a7e60e64c6f1ebfdae0ffe169988a687468;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/CreateAlbumPage.java b/src/main/java/net/pterodactylus/sone/web/CreateAlbumPage.java index 9072ea4..a8d024a 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreateAlbumPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreateAlbumPage.java @@ -1,5 +1,5 @@ /* - * Sone - CreateAlbumPage.java - Copyright © 2011 David Roden + * Sone - CreateAlbumPage.java - Copyright © 2011–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 @@ -64,8 +64,11 @@ 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)); + album.modify().setTitle(name).setDescription(TextFilter.filter(request.getHttpRequest().getHeader("host"), description)).update(); webInterface.getCore().touchConfiguration(); throw new RedirectException("imageBrowser.html?album=" + album.getId()); }