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
|
||||
|
||||
# Set the license file path
|
||||
#
|
||||
# Set and display project path
|
||||
#
|
||||
|
||||
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$PROJECT_PATH
|
||||
echo "Using project path \"$UNITY_PROJECT_PATH\"."
|
||||
|
||||
# Set the artifacts path
|
||||
if [ -z "$ARTIFACTS_PATH" ]; then
|
||||
ARTIFACTS_PATH=artifacts
|
||||
fi
|
||||
#
|
||||
# Set and display the artifacts path
|
||||
#
|
||||
|
||||
echo "Using build path \"$ARTIFACTS_PATH\" to save test results."
|
||||
FULL_ARTIFACTS_PATH=$GITHUB_WORKSPACE/$ARTIFACTS_PATH
|
||||
|
||||
|
|
|
@ -6,6 +6,12 @@ class Input {
|
|||
return ['all', 'playmode', 'editmode'];
|
||||
}
|
||||
|
||||
static isValidFolderName(folderName) {
|
||||
const validFolderName = new RegExp(/^(\.|\.\/)?(\.?\w+\/?)*$/);
|
||||
|
||||
return validFolderName.test(folderName);
|
||||
}
|
||||
|
||||
static getFromUser() {
|
||||
// Input variables specified in workflow using "with" prop.
|
||||
const unityVersion = getInput('unityVersion') || '2019.2.11f1';
|
||||
|
@ -18,6 +24,14 @@ class Input {
|
|||
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
|
||||
const projectPath = rawProjectPath.replace(/\/$/, '');
|
||||
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
||||
|
|
Loading…
Reference in New Issue