Skip to content

Commit

Permalink
RuboCop: Style/RedundantRegexpEscape
Browse files Browse the repository at this point in the history
[skip-stages=Flakey]

auto-corrected

Change-Id: I21b955242be4150034f8188eb24049cd1204956d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277883
Tested-by: Service Cloud Jenkins <[email protected]>
Reviewed-by: Simon Williams <[email protected]>
QA-Review: Cody Cutrer <[email protected]>
Product-Review: Cody Cutrer <[email protected]>
  • Loading branch information
ccutrer committed Nov 11, 2021
1 parent cf213ee commit f23a491
Show file tree
Hide file tree
Showing 57 changed files with 159 additions and 157 deletions.
2 changes: 2 additions & 0 deletions .rubocop.common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ Style/RedundantFreeze:
Severity: error
Style/RedundantParentheses:
Severity: error
Style/RedundantRegexpEscape:
Severity: error
Style/SpecialGlobalVars:
Enabled: false # $! and $? are fine
Style/WhileUntilModifier:
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ def collection_cache_key(collection)
end

def add_uri_scheme_name(uri)
noSchemeName = !uri.match(%r{^(.+):\/\/(.+)})
noSchemeName = !uri.match(%r{^(.+)://(.+)})
uri = 'http://' + uri if noSchemeName
uri
end
Expand Down Expand Up @@ -1187,7 +1187,7 @@ def active_path?(to_test)

# Determine if url is the current state for the groups sub-nav switcher
def group_homepage_pathfinder(group)
request.fullpath =~ %r{groups\/#{group.id}}
request.fullpath =~ %r{groups/#{group.id}}
end

def link_to_parent_signup(auth_type)
Expand Down
4 changes: 2 additions & 2 deletions app/models/access_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def url_scopes_for_method(method)
scopes.select { |scope| re =~ scope }.map do |scope|
path = scope.split('|').last
# build up the scope matching regexp from the route path
path = path.gsub(/:[^\/\)]+/, '[^/]+') # handle dynamic segments /courses/:course_id -> /courses/[^/]+
path = path.gsub(/\*[^\/\)]+/, '.+') # handle glob segments /files/*path -> /files/.+
path = path.gsub(/:[^\/)]+/, '[^/]+') # handle dynamic segments /courses/:course_id -> /courses/[^/]+
path = path.gsub(/\*[^\/)]+/, '.+') # handle glob segments /files/*path -> /files/.+
path = path.gsub(/\(/, '(?:').gsub(/\)/, '|)') # handle optional segments /files(/[^/]+) -> /files(?:/[^/]+|)
path = "#{path}(?:\\\.[^/]+|)" # handle format segments /files(.:format) -> /files(?:\.[^/]+|)
Regexp.new("^#{path}$")
Expand Down
4 changes: 2 additions & 2 deletions app/models/asset_user_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def context_code
end

def readable_name(include_group_name: true)
if self.asset_code && self.asset_code.match(/\:/)
split = self.asset_code.split(/\:/)
if self.asset_code && self.asset_code.match(/:/)
split = self.asset_code.split(/:/)

if split[1].match(/course_\d+/)
case split[0]
Expand Down
4 changes: 2 additions & 2 deletions app/models/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def assert_file_extension
end

def extension
res = (self.filename || "").match(/(\.[^\.]*)\z/).to_s
res = (self.filename || "").match(/(\.[^.]*)\z/).to_s
res = nil if res == ""
if !res || res == ""
res = File.mime_types[self.content_type].to_s rescue nil
Expand Down Expand Up @@ -588,7 +588,7 @@ def process_s3_details!(details)
self.workflow_state = nil
self.file_state = 'available'
end
self.md5 = (details[:etag] || "").gsub(/\"/, '')
self.md5 = (details[:etag] || "").gsub(/"/, '')
self.content_type = details[:content_type]
self.size = details[:content_length]

Expand Down
2 changes: 1 addition & 1 deletion app/models/context_external_tool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ def matches_tool_domain?(url)
url = ContextExternalTool.standardize_url(url)
host = Addressable::URI.parse(url).normalize.host rescue nil
port = Addressable::URI.parse(url).normalize.port rescue nil
d = domain.downcase.gsub(/http[s]?\:\/\//, '')
d = domain.downcase.gsub(/http[s]?:\/\//, '')
!!(host && ('.' + host + (port ? ":#{port}" : '')).match(/\.#{d}\z/))
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/discussion_topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ def self.podcast_elements(messages, context)
txt = (message.message || "")
attachment_matches = txt.scan(/\/#{context.class.to_s.pluralize.underscore}\/#{context.id}\/files\/(\d+)\/download/)
attachment_ids += (attachment_matches || []).map { |m| m[0] }
media_object_matches = txt.scan(/media_comment_([\w\-]+)/) + txt.scan(/data-media-id=\"([\w\-]+)\"/)
media_object_matches = txt.scan(/media_comment_([\w\-]+)/) + txt.scan(/data-media-id="([\w\-]+)"/)
media_object_ids += (media_object_matches || []).map { |m| m[0] }.uniq
(attachment_ids + media_object_ids).each do |id|
messages_hash[id] ||= message
Expand Down
2 changes: 1 addition & 1 deletion app/models/exporters/zip_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def initialize(content_export)
end

def archive_name
@archive_name ||= "#{@common_folder_name.gsub(/[\x00-0x20\/\\\?:*"`\s]/, '_')}_export.zip"
@archive_name ||= "#{@common_folder_name.gsub(/[\x00-0x20\/\\?:*"`\s]/, '_')}_export.zip"
end

def export
Expand Down
8 changes: 4 additions & 4 deletions app/models/importers/link_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ def parse_url(url, node, attr)
unresolved(:wiki_page, :migration_id => $1)
elsif url =~ /discussion_topic_migration_id=(.*)/
unresolved(:discussion_topic, :migration_id => $1)
elsif url =~ %r{\$CANVAS_COURSE_REFERENCE\$/modules/items/([^\?]*)(\?.*)?}
elsif url =~ %r{\$CANVAS_COURSE_REFERENCE\$/modules/items/([^?]*)(\?.*)?}
unresolved(:module_item, :migration_id => $1, :query => $2)
elsif url =~ %r{\$CANVAS_COURSE_REFERENCE\$/file_ref/([^/\?#]+)(.*)}
elsif url =~ %r{\$CANVAS_COURSE_REFERENCE\$/file_ref/([^/?#]+)(.*)}
unresolved(:file_ref, :migration_id => $1, :rest => $2,
:in_media_iframe => attr == 'src' && node.name == 'iframe' && node['data-media-id'])
elsif url =~ %r{(?:\$CANVAS_OBJECT_REFERENCE\$|\$WIKI_REFERENCE\$)/([^/]*)/([^\?]*)(\?.*)?}
elsif url =~ %r{(?:\$CANVAS_OBJECT_REFERENCE\$|\$WIKI_REFERENCE\$)/([^/]*)/([^?]*)(\?.*)?}
unresolved(:object, :type => $1, :migration_id => $2, :query => $3)

elsif url =~ %r{\$CANVAS_COURSE_REFERENCE\$/(.*)}
Expand All @@ -154,7 +154,7 @@ def parse_url(url, node, attr)
(attr == 'src' && node.name == 'iframe' && node['data-media-id'])
# Course copy media reference, leave it alone
resolved
elsif attr == 'src' && (info_match = url.match(/\Adata:(?<mime_type>[-\w]+\/[-\w\+\.]+)?;base64,(?<image>.*)/m))
elsif attr == 'src' && (info_match = url.match(/\Adata:(?<mime_type>[-\w]+\/[-\w+.]+)?;base64,(?<image>.*)/m))
link_embedded_image(info_match)
elsif # rubocop:disable Lint/DuplicateBranch
# Equation image, leave it alone
Expand Down
2 changes: 1 addition & 1 deletion app/models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def title=(title)
def infer_path
return nil unless title

path = base_path = title.downcase.gsub(/[^a-z0-9]+/, '-').gsub(/\A\-+|\-+\z/, '')
path = base_path = title.downcase.gsub(/[^a-z0-9]+/, '-').gsub(/\A-+|-+\z/, '')
count = 0
while (profile = Profile.where(root_account_id: root_account_id, path: path).first)
break if profile.id == id
Expand Down
4 changes: 2 additions & 2 deletions app/models/quizzes/quiz_statistics/student_analysis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def to_csv
elsif question[:question_type] == 'calculated_question'
list = question[:answers].take(1).flat_map do |ans|
ans[:variables] && ans[:variables].map do |variable|
[variable[:name], variable[:value].to_s].map { |str| str.gsub(/\=>/, '\=>') }.join('=>')
[variable[:name], variable[:value].to_s].map { |str| str.gsub(/=>/, '\=>') }.join('=>')
end
end
list << answer[:text]
Expand All @@ -303,7 +303,7 @@ def to_csv
res << (question[:answers].detect { |a| a[:id] == answer_id } || {})[:text]
match = question[:matches].detect { |m| m[:match_id] == match_id } || question[:answers].detect { |m| m[:match_id] == match_id } || {}
res << (match[:right] || match[:text])
res.map { |s| (s || '').gsub(/\=>/, '\=>') }.join('=>').gsub(/,/, '\,')
res.map { |s| (s || '').gsub(/=>/, '\=>') }.join('=>').gsub(/,/, '\,')
end.join(',')
elsif question[:question_type] == 'numerical_question'
row << (answer && answer[:text])
Expand Down
2 changes: 1 addition & 1 deletion app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ def url

def plaintext_body
self.extend HtmlTextHelper
strip_tags((self.body || "").gsub(/\<\s*br\s*\/\>/, "\n<br/>").gsub(/\<\/p\>/, "</p>\n"))
strip_tags((self.body || "").gsub(/<\s*br\s*\/>/, "\n<br/>").gsub(/<\/p>/, "</p>\n"))
end

TURNITIN_STATUS_RETRY = 11
Expand Down
4 changes: 2 additions & 2 deletions app/models/wiki_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ def self.reinterpret_version_yaml(yaml_string)
# in the yaml. This doctors the yaml back, and can be removed
# when the "content_imports" exception type for psych syntax errors
# isn't happening anymore.
pattern_1 = /(\<a[^<>]*?id=.*?"media_comment.*?\/\>)/im
pattern_2 = /(\<a[^<>]*?id=.*?"media_comment.*?\<\/a\>)/
pattern_1 = /(<a[^<>]*?id=.*?"media_comment.*?\/>)/im
pattern_2 = /(<a[^<>]*?id=.*?"media_comment.*?<\/a>)/
replacements = []
[pattern_1, pattern_2].each do |regex_pattern|
yaml_string.scan(regex_pattern).each do |matched_groups|
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ def deconstruct_joins(joins_sql = nil)
join_conditions = []
joins_sql.strip.split('INNER JOIN')[1..-1].each do |join|
# this could probably be improved
raise "PostgreSQL update_all/delete_all only supports INNER JOIN" unless join.strip =~ /([a-zA-Z0-9'"_\.]+(?:(?:\s+[aA][sS])?\s+[a-zA-Z0-9'"_]+)?)\s+ON\s+(.*)/m
raise "PostgreSQL update_all/delete_all only supports INNER JOIN" unless join.strip =~ /([a-zA-Z0-9'"_.]+(?:(?:\s+[aA][sS])?\s+[a-zA-Z0-9'"_]+)?)\s+ON\s+(.*)/m

tables << $1
join_conditions << $2
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
end

concern :pages do
resources :wiki_pages, path: :pages, except: [:update, :destroy, :new], constraints: { id: %r{[^\/]+} } do
resources :wiki_pages, path: :pages, except: [:update, :destroy, :new], constraints: { id: %r{[^/]+} } do
get 'revisions' => 'wiki_pages#revisions', as: :revisions
end

Expand Down
4 changes: 2 additions & 2 deletions doc/api/fulldoc/html/swagger/argument_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def split_type_desc(str)
# This regex is impossible to read, basically we're splitting the string up
# into the first [bracketed] section, which might contain internal brackets,
# and then the rest of the string.
md = str.strip.match(%r{\A(\[[\w ,\[\]\|"]+\])?\s*(.+)?}m)
md = str.strip.match(%r{\A(\[[\w ,\[\]|"]+\])?\s*(.+)?}m)
[md[1] || DEFAULT_TYPE, md[2] || DEFAULT_DESC]
end

Expand All @@ -80,7 +80,7 @@ def remove_outer_square_brackets(str)

def metadata_parts
remove_outer_square_brackets(@type)
.split(/\s*[,\|]\s*/).map { |t| t.force_encoding('UTF-8') }
.split(/\s*[,|]\s*/).map { |t| t.force_encoding('UTF-8') }
end

def enum_and_types
Expand Down
2 changes: 1 addition & 1 deletion doc/api/fulldoc/html/swagger/object_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ def to_model
end

def self.strip_comments(str)
str.gsub(%r(//[^\n\"]+$), '')
str.gsub(%r(//[^\n"]+$), '')
end
end
2 changes: 1 addition & 1 deletion doc/api/fulldoc/html/swagger/route_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def api_path
end

def remove_parentheticals(str)
str.gsub(/\([^\)]+\)/, '')
str.gsub(/\([^)]+\)/, '')
end

def path_variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,12 @@ def call_permission_cache_key_for(*args)
end

actor = actor_class.new
expect(actor.call_permission_cache_key_for(nil, session, :read)).to match(/\>\/permissions_key\/read$/)
expect(actor.call_permission_cache_key_for(nil, session, :read)).to match(/>\/permissions_key\/read$/)

session.delete(:permissions_key)
expect(actor.call_permission_cache_key_for(nil, session, :read)).to match(/\>\/default\/read$/)
expect(actor.call_permission_cache_key_for(nil, session, :read)).to match(/>\/default\/read$/)

expect(actor.call_permission_cache_key_for(nil, nil, :read)).to match(/\>\/read$/)
expect(actor.call_permission_cache_key_for(nil, nil, :read)).to match(/>\/read$/)
end

it 'must not use the rails cache for permissions included in the configured blacklist' do
Expand Down
2 changes: 1 addition & 1 deletion gems/attachment_fu/lib/attachment_fu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def sanitize_filename(filename)
name.gsub!(/^.*(\\|\/)/, '')

# Finally, replace all non alphanumeric, underscore or periods with underscore
name.gsub!(/[^\w\.\-]/, '_')
name.gsub!(/[^\w.\-]/, '_')
end
end

Expand Down
2 changes: 1 addition & 1 deletion gems/canvas_stringex/lib/lucky_sneaks/string_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def convert_misc_characters
replaced = " #{replaced} " unless replaced =~ /\\1/
dummy.gsub!(found, replaced)
end
dummy = dummy.gsub(/(^|\w)'(\w|$)/, '\1\2').gsub(/[\.,:;()\[\]\/\?!\^'"_]/, " ")
dummy = dummy.gsub(/(^|\w)'(\w|$)/, '\1\2').gsub(/[.,:;()\[\]\/?!\^'"_]/, " ")
end

# Replace runs of whitespace in string. Defaults to a single space but any replacement
Expand Down
6 changes: 3 additions & 3 deletions gems/dr_diff/lib/dr_diff/diff_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ def parse_raw_diff(raw_diff)
end

def line_gone?(line)
line =~ /^\-/
line =~ /^-/
end

def code_line?(line)
return false if file_line?(line)
return false if line_range?(line)
return false if line =~ /^\-\-\- a\/.*\./
return false if line =~ /^--- a\/.*\./
return false if line =~ /^index .*\d\d\d$/
return false if line =~ /^diff \-\-git/
return false if line =~ /^diff --git/

true
end
Expand Down
2 changes: 1 addition & 1 deletion gems/google_drive/lib/google_drive/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def file_extension_from_header(headers, entry)
file_extension = (entry.extension && !entry.extension.empty? && entry.extension) || 'unknown'

if headers['content-disposition'] &&
headers['content-disposition'].match(/filename=[\"\']?[^;\"\'\.]+\.(?<file_extension>[^;\"\']+)[\"\']?/)
headers['content-disposition'].match(/filename=["']?[^;"'.]+\.(?<file_extension>[^;"']+)["']?/)
file_extension = Regexp.last_match[:file_extension]
end

Expand Down
10 changes: 5 additions & 5 deletions gems/i18n_tasks/lib/i18n_tasks/i18n_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ def find_mismatches
end
end

LIST_ITEM_PATTERN = /^ {0,3}(\d+\.|\*|\+|\-)\s/
LIST_ITEM_PATTERN = /^ {0,3}(\d+\.|\*|\+|-)\s/

def markdown_and_wrappers(str)
# Since underscores can be wrappers, and underscores can also be inside
# placeholders (as placeholder names) we need to be unambiguous about
# underscores in placeholders:
dashed_str = str.gsub(/%\{([^\}]+)\}/) { |x| x.gsub("_", "-") }
dashed_str = str.gsub(/%\{([^}]+)\}/) { |x| x.gsub("_", "-") }
# some stuff this doesn't check (though we don't use):
# blockquotes, e.g. "> some text"
# reference links, e.g. "[an example][id]"
# indented code
matches = scan_and_report(dashed_str, /\\[\\`\*_\{\}\[\]\(\)#\+\-\.!]/) # escaped special char
matches = scan_and_report(dashed_str, /\\[\\`*_{}\[\]()#+\-.!]/) # escaped special char
.concat(wrappers(dashed_str))
.concat(scan_and_report(dashed_str, /(!?\[)[^\]]+\]\(([^\)"']+).*?\)/).map { |m| "link:#{m.last}" }) # links
.concat(scan_and_report(dashed_str, /(!?\[)[^\]]+\]\(([^)"']+).*?\)/).map { |m| "link:#{m.last}" }) # links

# only do fancy markdown checks on multi-line strings
if dashed_str =~ /\n/
Expand Down Expand Up @@ -175,7 +175,7 @@ def wrappers(str)
end

def placeholders(str)
str.scan(/%h?\{[^\}]+\}/).sort
str.scan(/%h?\{[^}]+\}/).sort
rescue ArgumentError => e
puts "Unable to scan string: #{str.inspect}"
raise e
Expand Down
2 changes: 1 addition & 1 deletion gems/i18n_tasks/lib/i18n_tasks/lolcalize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def translate(*args)
# see also ui/shared/i18n/i18nLolcalize.js
def let_there_be_lols(str)
# don't want to mangle placeholders, wrappers, etc.
pattern = /(\s*%h?\{[^\}]+\}\s*|\s*[\n\\`\*_\{\}\[\]\(\)\#\+\-!]+\s*|^\s+)/
pattern = /(\s*%h?\{[^}]+\}\s*|\s*[\n\\`*_{}\[\]()\#+\-!]+\s*|^\s+)/
result = str.split(pattern).map do |token|
if token =~ pattern
token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def parse_question_data
imported_formula = @doc.at_css('calculated formula')
@question[:imported_formula] = CGI.unescape(imported_formula.text) if imported_formula
get_calculated_property('answer_tolerance')
if @question[:answer_tolerance] && !@question[:answer_tolerance].to_s.match(/[^\d\.]/)
if @question[:answer_tolerance] && !@question[:answer_tolerance].to_s.match(/[^\d.]/)
@question[:answer_tolerance] = @question[:answer_tolerance].to_f
end

Expand Down
4 changes: 2 additions & 2 deletions gems/plugins/qti_exporter/lib/qti/html_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def find_best_path_match(path)
def escape_unmatched_brackets(string)
unmatched = false
lcount = 0
string.scan(/[\<\>]/) do |s|
string.scan(/[<>]/) do |s|
if s == ">"
if lcount == 0
unmatched = true
Expand All @@ -128,7 +128,7 @@ def escape_unmatched_brackets(string)
string = Nokogiri::HTML5.fragment(string).to_xml rescue string
end

string.split(/(\<[^\<\>]*\>)/m).map do |sub|
string.split(/(<[^<>]*>)/m).map do |sub|
if sub.strip.start_with?("<") && sub.strip.end_with?(">")
sub
else
Expand Down
2 changes: 1 addition & 1 deletion gems/plugins/qti_exporter/lib/qti/numeric_interaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_canvas_answers
is_precision = false
if (lower_node = or_node.at_css('and customOperator[class=vargt] baseValue')) &&
(upper_node = or_node.at_css('and customOperator[class=varlte] baseValue')) &&
lower_node.text.gsub(/[0\.]/, "").end_with?("5") && upper_node.text.gsub(/[0\.]/, "").end_with?("5")
lower_node.text.gsub(/[0.]/, "").end_with?("5") && upper_node.text.gsub(/[0.]/, "").end_with?("5")
# tl;dr - super hacky way to try to detect the precision answers
upper = upper_node.text.to_d
lower = lower_node.text.to_d
Expand Down
2 changes: 1 addition & 1 deletion lib/basic_lti/quizzes_next_versioned_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def attempts_hash

# ruby hash will perserve insertion order
sorted_list = attempts.keys.sort_by do |k|
matches = k.match(/\?.*=(\d+)\&/)
matches = k.match(/\?.*=(\d+)&/)
next 0 if matches.blank?

matches.captures.first.to_i # ordered by the first lti parameter
Expand Down
2 changes: 1 addition & 1 deletion lib/cc/importer/blti_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def check_for_unescaped_url_properties(obj)
end

def check_for_unescaped_url(url)
if url =~ /(.*[^\=]*\?*\=)[^\&;]*\=/
if url =~ /(.*[^=]*\?*=)[^&;]*=/
raise CCImportError.new(I18n.t(:invalid_url_in_xml, "Invalid url in xml. Ampersands must be escaped."))
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/content_zipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def sanitize_file_name(filename)
end

def sanitize_attachment_filename(filename)
filename.gsub(/[\x00\/\\:\*\?\"<>\|]+/, '_')
filename.gsub(/[\x00\/\\:*?"<>|]+/, '_')
end

def sanitize_user_name(user_name)
Expand Down
2 changes: 1 addition & 1 deletion lib/course_link_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def self.process(progress)
def initialize(course)
self.course = course
domain = course.root_account.domain
self.domain_regex = %r{\w+:?\/\/#{domain}\/} if domain
self.domain_regex = %r{\w+:?//#{domain}/} if domain
self.issues = []
self.visited_urls = {}
end
Expand Down
Loading

0 comments on commit f23a491

Please sign in to comment.