added regex to check whitespace

This commit is contained in:
Vidya Reddy 2022-08-06 10:25:18 +05:30
parent 36041268eb
commit ce6bc40bc4
2 changed files with 1 additions and 3 deletions

View File

@ -8,8 +8,6 @@ export class DockerExec {
} }
public async pull(image: string, args: string[], silent?: boolean) { public async pull(image: string, args: string[], silent?: boolean) {
image = image.replace(/^[ ]+/g, '') //Remove whitespace at beginning of the string
image = image.replace(/[ ]+$/g, '') //Remove whitespace at end of the string
const result = await this.execute(['pull', image, ...args], silent) const result = await this.execute(['pull', image, ...args], silent)
if (result.stderr != '' || result.exitCode != 0) { if (result.stderr != '' || result.exitCode != 0) {
throw new Error(`docker images pull failed: ${result.stderr}`) throw new Error(`docker images pull failed: ${result.stderr}`)

View File

@ -25,7 +25,7 @@ export async function getDeploymentConfig(): Promise<DeploymentConfig> {
let imageNames = core.getInput('images').split('\n') || [] let imageNames = core.getInput('images').split('\n') || []
imageNames.forEach((element) => { imageNames.forEach((element) => {
if (element == ' ' || '') { if (element === null || '/^s+$/') {
imageNames.pop() imageNames.pop()
} }
}) })