Skip to content

Commit

Permalink
Fixed space char on input filename
Browse files Browse the repository at this point in the history
  • Loading branch information
bayrakmustafa committed Nov 23, 2023
1 parent 51daed1 commit 9ce4296
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 7 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,40 @@ jobs:
name: sign.ps1
path: ./artifacts/codesign.ps1

sign-input-space:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
needs: ['build']
steps:
- uses: actions/checkout@v3

- name: Create Input file for test signing
shell: bash
run: |
mkdir -p ${GITHUB_WORKSPACE}/example
cp "./sample/sample file.exe" "${GITHUB_WORKSPACE}/example/sample file.exe"
- uses: ./
with:
command: sign
username: ${{ secrets.ES_USERNAME }}
password: ${{ secrets.ES_PASSWORD }}
credential_id: ${{ secrets.CREDENTIAL_ID }}
totp_secret: ${{ secrets.ES_TOTP_SECRET }}
file_path: ${GITHUB_WORKSPACE}/example/sample file.exe
output_path: ${GITHUB_WORKSPACE}/artifacts
malware_block: false
environment_name: TEST
jvm_max_memory: 2048M

- name: Upload Signed Files
uses: actions/upload-artifact@v3
with:
name: sign-space.exe
path: ./artifacts/sample file.exe

sign-override:
strategy:
matrix:
Expand Down
6 changes: 3 additions & 3 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.

Binary file added sample/sample file.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion src/setup-codesigner/codesigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class CodeSigner {

let execCmd = path.join(archivePath, cmd);
const execData = readFileSync(execCmd, { encoding: 'utf-8', flag: 'r' });
const result = execData.replace(/java -cp/g, `java -Xmx${jvmMaxMemory} -cp`);
const result = execData.replace(/java -jar/g, `java -Xmx${jvmMaxMemory} -jar`).replace(/\$@/g, `"\$@"`);
core.info(`Exec Cmd Content: ${result}`);
writeFileSync(execCmd, result, { encoding: 'utf-8', flag: 'w' });
chmodSync(execCmd, '0755');
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ export function setCommand(inputKey: string, command: string, action: string): s
command = `${command} -program_name=${input}`;
} else if (inputKey == INPUT_FILE_PATH) {
input = path.normalize(input);
command = `${command} -input_file_path=${input}`;
command = `${command} -input_file_path="${input}"`;
} else if (inputKey == INPUT_DIR_PATH) {
input = path.normalize(input);
command = `${command} -input_dir_path=${input}`;
command = `${command} -input_dir_path="${input}"`;
} else if (inputKey == INPUT_OUTPUT_PATH) {
input = path.normalize(input);
if (fs.existsSync(input)) {
Expand Down

0 comments on commit 9ce4296

Please sign in to comment.