Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update safe output regex and the docs #1805

Merged
merged 11 commits into from
Dec 23, 2023
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,12 @@ Support this project with a :star:
# Default: "\n"
recover_files_separator: ''

# Apply sanitization to output filenames before being set as
# output.
# Type: boolean
# Default: "true"
safe_output: ''

# Split character for output strings.
# Type: string
# Default: " "
Expand Down
47 changes: 33 additions & 14 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,10 @@ export const setOutput = async ({

// if safeOutput is true, escape special characters for bash shell
if (safeOutput) {
cleanedValue = cleanedValue.replace(/[$()`|&;]/g, '\\$&')
cleanedValue = cleanedValue.replace(
/[^\x20-\x7E]|[:*?"<>|;`$()&!]/g,
'\\$&'
)
}

core.setOutput(key, cleanedValue)
Expand Down