2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 09:10:25 +08:00

slightly shorter regexp for OptimizedImage.safe_path?

This commit is contained in:
Régis Hanol 2017-01-02 16:28:14 +01:00
parent d8be3e8bb1
commit c4552ef8c1

View file

@ -101,7 +101,7 @@ class OptimizedImage < ActiveRecord::Base
# this matches instructions which call #to_s # this matches instructions which call #to_s
path = path.to_s path = path.to_s
return false if path != File.expand_path(path) return false if path != File.expand_path(path)
return false if path !~ /\A[_\-a-zA-Z0-9\.\/]+\z/m return false if path !~ /\A[\w\-\.\/]+\z/m
true true
end end