about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--extras/autoindex.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/extras/autoindex.rb b/extras/autoindex.rb
index 2305c3c..d30f000 100644
--- a/extras/autoindex.rb
+++ b/extras/autoindex.rb
@@ -107,7 +107,9 @@ class Autoindex
 
       if ngz_idx
         ngz_idx.each do |name, entry|
-          ngz_path = name.dup.gsub!(/\.gz\z/, '')
+          # n.b: use use dup.sub! to ensure ngz_path is nil
+          # if .gz is not found
+          ngz_path = name.dup.sub!(/\.gz\z/, '')
           ngz_idx.include?(ngz_path) or files << entry
         end
       end