diff --git a/lib/gollum/committer.rb b/lib/gollum/committer.rb index fb4c202c..85779e8a 100644 --- a/lib/gollum/committer.rb +++ b/lib/gollum/committer.rb @@ -100,9 +100,13 @@ module Gollum tree.blobs.each do |blob| next if page_path_scheduled_for_deletion?(index.tree, fullpath) - file = blob.name.downcase.sub(/\.\w+$/, '') - file_ext = ::File.extname(blob.name).sub(/^\./, '') - if downpath == file && !(allow_same_ext && file_ext == ext) + + existing_file = blob.name.downcase.sub(/\.\w+$/, '') + existing_file_ext = ::File.extname(blob.name).sub(/^\./, '') + + new_file_ext = ::File.extname(path).sub(/^\./, '') + + if downpath == existing_file && !(allow_same_ext && new_file_ext == existing_file_ext) raise DuplicatePageError.new(dir, blob.name, path) end end