mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 00:08:53 +08:00
DEV: Prefer \A and \z over ^ and $ in regexes (#19936)
This commit is contained in:

committed by
GitHub

parent
f7907a3645
commit
666536cbd1
@ -675,17 +675,17 @@ class Plugin::Instance
|
||||
DiscoursePluginRegistry.register_glob(admin_path, "hbr", admin: true)
|
||||
|
||||
DiscourseJsProcessor.plugin_transpile_paths << root_path.sub(Rails.root.to_s, "").sub(
|
||||
%r{^/*},
|
||||
%r{\A/*},
|
||||
"",
|
||||
)
|
||||
DiscourseJsProcessor.plugin_transpile_paths << admin_path.sub(Rails.root.to_s, "").sub(
|
||||
%r{^/*},
|
||||
%r{\A/*},
|
||||
"",
|
||||
)
|
||||
|
||||
test_path = "#{root_dir_name}/test/javascripts"
|
||||
DiscourseJsProcessor.plugin_transpile_paths << test_path.sub(Rails.root.to_s, "").sub(
|
||||
%r{^/*},
|
||||
%r{\A/*},
|
||||
"",
|
||||
)
|
||||
end
|
||||
@ -1299,7 +1299,7 @@ class Plugin::Instance
|
||||
private
|
||||
|
||||
def validate_directory_column_name(column_name)
|
||||
match = /^[_a-z]+$/.match(column_name)
|
||||
match = /\A[_a-z]+\z/.match(column_name)
|
||||
unless match
|
||||
raise "Invalid directory column name '#{column_name}'. Can only contain a-z and underscores"
|
||||
end
|
||||
|
Reference in New Issue
Block a user