forked from e621ng/e621ng
[UploadWhitelist] Make upload whitelist case insensitive (#651)
This commit is contained in:
parent
ea8c7d79ff
commit
165cd315e9
@ -1307,6 +1307,7 @@ Rails/OutputSafety:
|
||||
- 'app/views/users/custom_style.css.erb'
|
||||
- 'app/views/users/edit.html.erb'
|
||||
- 'app/views/users/home.html.erb'
|
||||
- 'app/views/upload_whitelists/_form.html.erb'
|
||||
|
||||
# Offense count: 9
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
|
@ -66,7 +66,7 @@ class UploadWhitelist < ApplicationRecord
|
||||
end
|
||||
|
||||
entries.each do |x|
|
||||
if File.fnmatch?(x.pattern, url)
|
||||
if File.fnmatch?(x.pattern, url, File::FNM_CASEFOLD)
|
||||
return [x.allowed, x.reason]
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
<%= custom_form_for(@whitelist) do |f| %>
|
||||
<%= error_messages_for "whitelist" %>
|
||||
|
||||
<%= f.input :pattern, label: "Pattern", as: :string %>
|
||||
<%= f.input :pattern, label: "Pattern", as: :string, hint: "* matches zero or more, ? matches exactly one character. See more #{link_to('here', 'https://apidock.com/ruby/v2_5_5/File/fnmatch/class')}.".html_safe %>
|
||||
<%= f.input :note, label: "Note", as: :string %>
|
||||
<%= f.input :allowed, label: "Upload Allowed", as: :boolean %>
|
||||
<%= f.input :reason, label: "Ban Reason", as: :string %>
|
||||
|
Loading…
Reference in New Issue
Block a user