-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
349 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class ConvertTaskDefFilenames < ActiveRecord::Migration[7.1] | ||
|
||
# Check filenames in the upload requirements for each task definition | ||
# and replace any invalid characters using sanitize filename | ||
def change | ||
TaskDefinition.find_in_batches do |group| | ||
group.each do |task_def| | ||
next if task_def.valid? | ||
|
||
upload_req = task_def.upload_requirements | ||
|
||
change = false | ||
upload_req.each do |req| | ||
unless req['name'].match?(/^[a-zA-Z0-9_\- \.]+$/) | ||
req['name'] = FileHelper.sanitized_filename(req['name']) | ||
change = true | ||
end | ||
|
||
if req['name'].blank? | ||
req['name'] = 'file' | ||
change = true | ||
end | ||
end | ||
|
||
unless change && task_def.valid? && task_def.save | ||
puts "Remaining issue with task definition #{task_def.id}" | ||
end | ||
puts '.' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,18 @@ def test_can_send_error_log_mail | |
assert mail.body.include? e.message | ||
assert mail.body.include? e.backtrace.join("\n") | ||
end | ||
|
||
def test_latex_error_logs_are_attached | ||
Doubtfire::Application.config.email_errors_to = 'test <[email protected]>' | ||
begin | ||
raise Task::LatexError.new('this is the content of the log'), 'test' | ||
rescue StandardError => e | ||
mail = ErrorLogMailer.error_message('test', 'test message', e) | ||
end | ||
|
||
assert mail.present? | ||
assert mail.to.include? '[email protected]' | ||
assert mail.attachments['log.txt'].present? | ||
assert mail.attachments['log.txt'].body.include? 'this is the content of the log' | ||
end | ||
end |
Oops, something went wrong.