Skip to content

Issue: Arguments passed to custom actions in Node are improperly formatted on both MacOs and Windows #628

Description

@steelcoder

Describe the bug
When invoking custom actions using Node.js, the arguments passed are mishandled on Windows. Specifically:

  1. Paths to scripts are not escaped, leading to issues when directory names contain spaces.
  2. The JSON argument for front matter, when escaped with single quotes, behaves differently between macOS and Windows. On Windows, the argument loses its double quotes when passed, causing JSON.parse to fail.
  3. Additionally, the command node does not recognize globally installed packages, necessitating absolute paths to libraries in scripts.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a custom action in Node.js.
  2. Provide a script path that contains spaces.
  3. Pass a JSON front matter argument enclosed with single quotes.
  4. Run the custom action on both macOS and Windows.
  5. Observe that on Windows, the script may fail due to spaces in the directory name and JSON.parse will throw an error due to the missing double quotes in the JSON argument.
  6. Also, note the inability to recognize globally installed packages.

Expected behavior
Arguments should be consistently and correctly passed to custom actions across different operating systems. Paths should be escaped to handle spaces, and JSON arguments should retain their original formatting. Also, globally installed Node.js packages should be recognized without the need for absolute paths.

Screenshots
N/A

Desktop (please complete the following information):

  • Windows 10 & 11 (x64), MacOs 13.5 (Apple Silicon)

Additional context
I am using version 8.4.0 of the software.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions