Use changed name when inserting a file.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 22 Mar 2012 20:10:46 +0000 (21:10 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 22 Mar 2012 20:10:46 +0000 (21:10 +0100)
src/de/todesbaum/jsite/application/ProjectInserter.java

index d16be3e..1f5e8ef 100644 (file)
@@ -331,13 +331,13 @@ public class ProjectInserter implements FileScannerListener, Runnable {
                        try {
                                long[] fileLength = new long[1];
                                InputStream fileEntryInputStream = createFileInputStream(filename, fileOption, edition, fileLength);
-                               fileEntry = new DirectFileEntry(filename, fileOption.getMimeType(), fileEntryInputStream, fileLength[0]);
+                               fileEntry = new DirectFileEntry(fileOption.hasChangedName() ? fileOption.getChangedName() : filename, fileOption.getMimeType(), fileEntryInputStream, fileLength[0]);
                        } catch (IOException ioe1) {
                                /* ignore, null is returned. */
                        }
                } else {
                        if (fileOption.isInsertRedirect()) {
-                               fileEntry = new RedirectFileEntry(filename, fileOption.getMimeType(), fileOption.getCustomKey());
+                               fileEntry = new RedirectFileEntry(fileOption.hasChangedName() ? fileOption.getChangedName() : filename, fileOption.getMimeType(), fileOption.getCustomKey());
                        }
                }
                return fileEntry;