mirror of
https://github.com/neocities/neocities.git
synced 2026-05-26 05:34:53 +00:00
regexp quotes for inputs
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ def education_whitelist_required?
|
||||
end
|
||||
|
||||
def education_whitelisted?
|
||||
return true if education_whitelist_required? && !$config['education_tag_whitelist'].select {|t| params[:new_tags_string].match(t)}.empty?
|
||||
return true if education_whitelist_required? && !$config['education_tag_whitelist'].select {|t| params[:new_tags_string].match(Regexp.quote(t))}.empty?
|
||||
false
|
||||
end
|
||||
|
||||
|
||||
+1
-1
@@ -282,7 +282,7 @@ post '/site/:username/block' do |username|
|
||||
|
||||
current_site.block! site
|
||||
|
||||
if request.referer.match /\/site\/#{username}/i
|
||||
if request.referer.match /\/site\/#{Regexp.quote(username)}/i
|
||||
redirect '/'
|
||||
else
|
||||
redirect request.referer
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ class String
|
||||
end
|
||||
|
||||
def unindent
|
||||
gsub /^#{scan(/^\s*/).min_by{|l|l.length}}/, ""
|
||||
gsub /^#{Regexp.quote(scan(/^\s*/).min_by{|l|l.length})}/, ""
|
||||
end
|
||||
|
||||
def blank?
|
||||
|
||||
+3
-3
@@ -731,11 +731,11 @@ class Site < Sequel::Model
|
||||
email.strip!
|
||||
|
||||
disposable_email_domains_whitelist.each do |whitelisted_disposable_email_domain|
|
||||
return false if email.match /@#{whitelisted_disposable_email_domain}$/i
|
||||
return false if email.match /@#{Regexp.quote(whitelisted_disposable_email_domain)}$/i
|
||||
end
|
||||
|
||||
disposable_email_domains.each do |disposable_email_domain|
|
||||
return true if email.match /@#{disposable_email_domain}$/i
|
||||
return true if email.match /@#{Regexp.quote(disposable_email_domain)}$/i
|
||||
end
|
||||
|
||||
false
|
||||
@@ -748,7 +748,7 @@ class Site < Sequel::Model
|
||||
email.strip!
|
||||
|
||||
banned_email_domains.each do |banned_email_domain|
|
||||
return true if email.match /@*#{banned_email_domain}$/i
|
||||
return true if email.match /@*#{Regexp.quote(banned_email_domain)}$/i
|
||||
end
|
||||
|
||||
false
|
||||
|
||||
+2
-2
@@ -116,10 +116,10 @@ class SiteFile < Sequel::Model
|
||||
self.save_changes
|
||||
|
||||
if is_directory
|
||||
site_files_in_dir = site.site_files.select {|sf| sf.path =~ /^#{current_path}\//}
|
||||
site_files_in_dir = site.site_files.select {|sf| sf.path =~ /^#{Regexp.quote(current_path)}\//}
|
||||
site_files_in_dir.each do |site_file|
|
||||
original_site_file_path = site_file.path
|
||||
site_file.path = site_file.path.gsub(/^#{current_path}\//, "#{new_path}\/")
|
||||
site_file.path = site_file.path.gsub(/^#{Regexp.quote(current_path)}\//, "#{Regexp.quote(new_path)}\/")
|
||||
site_file.save_changes
|
||||
site.delete_thumbnail_or_screenshot original_site_file_path
|
||||
site.generate_thumbnail_or_screenshot site_file.path
|
||||
|
||||
Reference in New Issue
Block a user