From 974869a6a8a7c24776cc7a0a623c5fdc02bbf755 Mon Sep 17 00:00:00 2001 From: hassaku Date: Wed, 7 Jan 2015 15:17:29 +0900 Subject: [PATCH] Escape argument not to substitute unintended path. --- app/models/fluentd/setting_archive/backup_file.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/fluentd/setting_archive/backup_file.rb b/app/models/fluentd/setting_archive/backup_file.rb index b2d2f61..6e53063 100644 --- a/app/models/fluentd/setting_archive/backup_file.rb +++ b/app/models/fluentd/setting_archive/backup_file.rb @@ -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