mirror of
https://github.com/neocities/neocities.git
synced 2025-08-21 16:40:53 +02:00
regexp quotes for inputs
This commit is contained in:
parent
9e54345720
commit
e9e4beb6eb
5 changed files with 8 additions and 8 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue