Fix calculation of project size.
[jSite.git] / src / de / todesbaum / jsite / application / Project.java
index bb722e7..fa0b774 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jSite - Project.java - Copyright © 2006–2011 David Roden
+ * jSite - Project.java - Copyright © 2006–2012 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 the Free Software
@@ -22,6 +22,7 @@ import java.io.File;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import de.todesbaum.util.mime.DefaultMIMETypes;
 
@@ -426,11 +427,14 @@ public class Project implements Comparable<Project> {
         * insert.
         */
        public void onSuccessfulInsert() {
-               for (FileOption fileOption : fileOptions.values()) {
-                       if ((fileOption.getCurrentHash() != null) && (fileOption.getCurrentHash().length() > 0) && !fileOption.getCurrentHash().equals(fileOption.getLastInsertHash())) {
+               for (Entry<String, FileOption> fileOptionEntry : fileOptions.entrySet()) {
+                       FileOption fileOption = fileOptionEntry.getValue();
+                       if ((fileOption.getCurrentHash() != null) && (fileOption.getCurrentHash().length() > 0) && (!fileOption.getCurrentHash().equals(fileOption.getLastInsertHash()) || fileOption.isForceInsert())) {
                                fileOption.setLastInsertEdition(edition);
                                fileOption.setLastInsertHash(fileOption.getCurrentHash());
+                               fileOption.setLastInsertFilename(fileOption.hasChangedName() ? fileOption.getChangedName() : fileOptionEntry.getKey());
                        }
+                       fileOption.setForceInsert(false);
                }
        }