Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Escape percent signs and reject newlines
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,11 @@ def initialize(options = {}) | |
|
||
def output | ||
job = process_template(@template, @options).strip | ||
process_template(@job_template, { :job => job }).strip | ||
out = process_template(@job_template, { :job => job }).strip | ||
if out =~ /\n/ | ||
raise ArgumentError, "Task contains newline" | ||
end | ||
out.gsub(/%/, '\%') | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
amiryal
Author
Contributor
|
||
end | ||
|
||
protected | ||
|
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
Out of curiosity, why do you want to escape percent signs? This mucks up using
date
formats in the output specifier, for simple log rotation.