redirect to proper directory
generate thumbnail for directories when not otherwise specified
This commit is contained in:
parent
2a3f55db82
commit
167e214a38
2 changed files with 12 additions and 4 deletions
|
|
@ -153,11 +153,15 @@ public class EntryDao {
|
||||||
|
|
||||||
Album childAlbum = read(dir);
|
Album childAlbum = read(dir);
|
||||||
Entry childCover = childAlbum.getCover();
|
Entry childCover = childAlbum.getCover();
|
||||||
|
if (childCover == null) {
|
||||||
|
Iterator<Entry> i = childAlbum.getContents().iterator();
|
||||||
|
childCover = i.hasNext() ? i.next() : null;
|
||||||
|
}
|
||||||
if (childCover != null) {
|
if (childCover != null) {
|
||||||
childCover.setFile(false);
|
childCover.setFile(false);
|
||||||
childCover.setName(dir.getName());
|
childCover.setName(dir.getName());
|
||||||
childCover.setPath(dir.getName() + "/" + childCover.getPath());
|
childCover.setPath(dir.getName() + "/" + childCover.getPath());
|
||||||
album.addContents(childCover);
|
album.addContents(childCover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,10 @@ public class AlbumServlet
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
|
if (!pathInfo.endsWith("/")) {
|
||||||
|
res.sendRedirect(req.getContextPath() + req.getRequestURI() + "/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
List<Entry> entries = dao.read(file).getContents();
|
List<Entry> entries = dao.read(file).getContents();
|
||||||
res.setContentType("text/html");
|
res.setContentType("text/html");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue