Use correct name of index file if it has been renamed.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 2 Feb 2015 18:45:18 +0000 (19:45 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 2 Feb 2015 18:45:18 +0000 (19:45 +0100)
src/main/java/de/todesbaum/jsite/application/ProjectInserter.java

index 709f557..35a2452 100644 (file)
@@ -365,7 +365,13 @@ public class ProjectInserter implements FileScannerListener, Runnable {
                String dirURI = "USK@" + project.getInsertURI() + "/" + project.getPath() + "/" + edition + "/";
                ClientPutComplexDir putDir = new ClientPutComplexDir("dir-" + counter++, dirURI, tempDirectory);
                if ((project.getIndexFile() != null) && (project.getIndexFile().length() > 0)) {
-                       putDir.setDefaultName(project.getIndexFile());
+                       FileOption indexFileOption = project.getFileOption(project.getIndexFile());
+                       Optional<String> changedName = indexFileOption.getChangedName();
+                       if (changedName.isPresent()) {
+                               putDir.setDefaultName(changedName.get());
+                       } else {
+                               putDir.setDefaultName(project.getIndexFile());
+                       }
                }
                putDir.setVerbosity(Verbosity.ALL);
                putDir.setMaxRetries(-1);