diff --git a/environment.rb b/environment.rb
index 606ef296..d9e3f21d 100644
--- a/environment.rb
+++ b/environment.rb
@@ -44,6 +44,7 @@ Sidekiq.configure_server do |config|
end
Sidekiq.configure_client do |config|
+ config.logger = nil
config.redis = sidekiq_redis_config
end
diff --git a/models/site.rb b/models/site.rb
index e0afcb1f..598c8ea9 100644
--- a/models/site.rb
+++ b/models/site.rb
@@ -70,7 +70,7 @@ class Site < Sequel::Model
/PHP\.Hide/
]
- SPAM_MATCH_REGEX = /#{$config['spam_smart_filter'].join('|')}/i
+ SPAM_MATCH_REGEX = ENV['RACK_ENV'] == 'test' ? /pillz/ : /#{$config['spam_smart_filter'].join('|')}/i
EMAIL_SANITY_REGEX = /.+@.+\..+/i
@@ -344,22 +344,26 @@ class Site < Sequel::Model
return false
end
- open(uploaded.path) { |f| matches = f.grep SPAM_MATCH_REGEX }
+ if File.extname(relative_path).match /\.#{EDITABLE_FILE_EXT}/
+ open(uploaded.path) {|f|
+ matches = f.grep SPAM_MATCH_REGEX
- if !matches.empty?
- EmailWorker.perform_async({
- from: 'web@neocities.org',
- reply_to: email,
- to: 'spam@neocities.org',
- subject: "[Neocities SPAM]: #{username}",
- body: %{
- #{username}
-
- https://#{self.host}#{relative_path}
-
- link
- }
- })
+ if !matches.empty?
+ EmailWorker.perform_async({
+ from: 'web@neocities.org',
+ reply_to: email,
+ to: 'spam@neocities.org',
+ subject: "[Neocities SPAM]: #{username}",
+ body: %{
+ #{username}
+
+ https://#{self.host}#{relative_path}
+
+ link
+ }
+ })
+ end
+ }
end
pathname = Pathname(path)