         else if former
           # Houston, we have a rename!
           if (new_name = file.filename) and new_name != filename
-            console.log filename, file
-            console.log "new_files", new_files
             if new_files[new_name] then errors.push
               message: "Impossible to rename a file to a filename that already exists"
               field: "files['#{filename}'].filename"

      for filename, file of json.files
        former = old_files[filename]

        console.log ""
        console.log "Handling", filename, file
        console.log ""
        
        # Normalize file structure to hash
        if _.isString(file) then file =
          filename: filename


    json.index ||= do ->
      filenames = _.keys(json.files)
      
      if "index.html" in filenames then "index.html"
      else
        html = _.filter filenames, (filename) -> /.html?$/.test(filename)
