mirror of https://github.com/actions/toolkit
parent
4beda9cbc0
commit
30995490f2
File diff suppressed because it is too large
Load Diff
|
@ -24,7 +24,7 @@
|
|||
"eslint-plugin-jest": "^22.21.0",
|
||||
"flow-bin": "^0.115.0",
|
||||
"jest": "^27.2.5",
|
||||
"lerna": "^4.0.0",
|
||||
"lerna": "^5.4.0",
|
||||
"prettier": "^1.19.1",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^3.9.9"
|
||||
|
|
|
@ -135,7 +135,9 @@ describe('@actions/core', () => {
|
|||
|
||||
expect(() => {
|
||||
core.exportVariable('my var', `good stuff ${DELIMITER} bad stuff`)
|
||||
}).toThrow(`Unexpected input: value should not contain the delimiter "${DELIMITER}"`)
|
||||
}).toThrow(
|
||||
`Unexpected input: value should not contain the delimiter "${DELIMITER}"`
|
||||
)
|
||||
|
||||
const filePath = path.join(__dirname, `test/${command}`)
|
||||
fs.unlinkSync(filePath)
|
||||
|
@ -147,7 +149,9 @@ describe('@actions/core', () => {
|
|||
|
||||
expect(() => {
|
||||
core.exportVariable(`good stuff ${DELIMITER} bad stuff`, 'test')
|
||||
}).toThrow(`Unexpected input: name should not contain the delimiter "${DELIMITER}"`)
|
||||
}).toThrow(
|
||||
`Unexpected input: name should not contain the delimiter "${DELIMITER}"`
|
||||
)
|
||||
|
||||
const filePath = path.join(__dirname, `test/${command}`)
|
||||
fs.unlinkSync(filePath)
|
||||
|
|
|
@ -4,7 +4,7 @@ import {toCommandProperties, toCommandValue} from './utils'
|
|||
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import {v4 as uuidv4} from 'uuid'
|
||||
|
||||
import {OidcClient} from './oidc-utils'
|
||||
|
||||
|
@ -91,11 +91,15 @@ export function exportVariable(name: string, val: any): void {
|
|||
|
||||
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
|
||||
if (name.includes(delimiter)) {
|
||||
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`)
|
||||
throw new Error(
|
||||
`Unexpected input: name should not contain the delimiter "${delimiter}"`
|
||||
)
|
||||
}
|
||||
|
||||
if (convertedVal.includes(delimiter)) {
|
||||
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`)
|
||||
throw new Error(
|
||||
`Unexpected input: value should not contain the delimiter "${delimiter}"`
|
||||
)
|
||||
}
|
||||
|
||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`
|
||||
|
|
Loading…
Reference in New Issue