def sanitize_name(name, prefer = nil)
      path = name.to_s

      # Check if we haven't got an extension
      # we'll assume you're looking for prefer or "html" otherwise
      path += ".#{prefer || 'html'}" unless File.basename(path).include?(".")

      path
    end
def sanitize_name(name, prefer = nil)
      path = name.to_s

      # Check if we haven't got an extension
      # we'll assume you're looking for prefer or "html" otherwise
      path += ".#{prefer || 'html'}" unless File.basename(path).include?(".")

      path
    end
Check if the name is a directory and append index
 Append preferred extension or html if it doesn't have one yet