Escape argument not to substitute unintended path.

This commit is contained in:
hassaku 2015-01-07 15:17:29 +09:00
parent 8b22f2d892
commit 974869a6a8

View File

@ -13,7 +13,7 @@ class Fluentd
def initialize(file_path, note = nil)
@file_path = file_path
@note = note || Note.create(file_path.sub(/#{FILE_EXTENSION}$/, Note::FILE_EXTENSION))
@note = note || Note.create(file_path.sub(/#{Regexp.escape(FILE_EXTENSION)}$/, Note::FILE_EXTENSION))
end
end
end