Enforce real folder names
parent
2ca91788af
commit
28154ea36e
File diff suppressed because one or more lines are too long
|
@ -1,13 +1,16 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Set the license file path
|
#
|
||||||
|
# Set and display project path
|
||||||
|
#
|
||||||
|
|
||||||
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$PROJECT_PATH
|
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$PROJECT_PATH
|
||||||
echo "Using project path \"$UNITY_PROJECT_PATH\"."
|
echo "Using project path \"$UNITY_PROJECT_PATH\"."
|
||||||
|
|
||||||
# Set the artifacts path
|
#
|
||||||
if [ -z "$ARTIFACTS_PATH" ]; then
|
# Set and display the artifacts path
|
||||||
ARTIFACTS_PATH=artifacts
|
#
|
||||||
fi
|
|
||||||
echo "Using build path \"$ARTIFACTS_PATH\" to save test results."
|
echo "Using build path \"$ARTIFACTS_PATH\" to save test results."
|
||||||
FULL_ARTIFACTS_PATH=$GITHUB_WORKSPACE/$ARTIFACTS_PATH
|
FULL_ARTIFACTS_PATH=$GITHUB_WORKSPACE/$ARTIFACTS_PATH
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,12 @@ class Input {
|
||||||
return ['all', 'playmode', 'editmode'];
|
return ['all', 'playmode', 'editmode'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isValidFolderName(folderName) {
|
||||||
|
const validFolderName = new RegExp(/^(\.|\.\/)?(\.?\w+\/?)*$/);
|
||||||
|
|
||||||
|
return validFolderName.test(folderName);
|
||||||
|
}
|
||||||
|
|
||||||
static getFromUser() {
|
static getFromUser() {
|
||||||
// Input variables specified in workflow using "with" prop.
|
// Input variables specified in workflow using "with" prop.
|
||||||
const unityVersion = getInput('unityVersion') || '2019.2.11f1';
|
const unityVersion = getInput('unityVersion') || '2019.2.11f1';
|
||||||
|
@ -18,6 +24,14 @@ class Input {
|
||||||
throw new Error(`Invalid testMode ${testMode}`);
|
throw new Error(`Invalid testMode ${testMode}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.isValidFolderName(rawArtifactsPath)) {
|
||||||
|
throw new Error(`Invalid artifactsPath "${rawArtifactsPath}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.isValidFolderName(rawProjectPath)) {
|
||||||
|
throw new Error(`Invalid projectPath "${rawProjectPath}"`);
|
||||||
|
}
|
||||||
|
|
||||||
// Sanitise input
|
// Sanitise input
|
||||||
const projectPath = rawProjectPath.replace(/\/$/, '');
|
const projectPath = rawProjectPath.replace(/\/$/, '');
|
||||||
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
||||||
|
|
Loading…
Reference in New Issue