lib/saved_assets.rb in markdown_exec-2.0.6 vs lib/saved_assets.rb in markdown_exec-2.0.7
- old
+ new
@@ -10,11 +10,12 @@
# given parameters. The `script_name` method derives a name for a script
# based on filename, prefix, time, and blockname. Similarly, the `stdout_name`
# method derives a name for stdout redirection.
#
class SavedAsset
- FNR11 = %r{/|:}.freeze
+ FNR11 = %r{[^!#$%&()\+,\-0-9=A-Z_a-z~]}.freeze
+ # / !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
FNR12 = '_'
DEFAULT_FTIME = '%F-%H-%M-%S'
# Generates a formatted script name based on the provided parameters.
def self.script_name(filename:, prefix:, time:, blockname:, ftime: DEFAULT_FTIME, join_str: '_', pattern: FNR11, replace: FNR12, exts: '.sh')
@@ -41,11 +42,11 @@
filename = 'sample.txt'
prefix = 'test'
time = Time.new(2023, 1, 1, 12, 0, 0)
blockname = 'block/1:2'
- expected_name = 'test_2023-01-01-12-00-00_sample.txt_,_block_1_2.sh'
+ expected_name = 'test_2023-01-01-12-00-00_sample_txt_,_block_1_2.sh'
assert_equal expected_name, MarkdownExec::SavedAsset.script_name(
filename: filename, prefix: prefix, time: time, blockname: blockname
)
end
@@ -53,10 +54,10 @@
filename = 'sample.txt'
prefix = 'test'
time = Time.new(2023, 1, 1, 12, 0, 0)
blockname = 'block/1:2'
- expected_name = 'test_2023-01-01-12-00-00_sample.txt_,_block_1_2.out.txt'
+ expected_name = 'test_2023-01-01-12-00-00_sample_txt_,_block_1_2.out.txt'
assert_equal expected_name, MarkdownExec::SavedAsset.stdout_name(
filename: filename, prefix: prefix, time: time, blockname: blockname
)
end
end