fix: Fixed array handling and argument passing in script #310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
I noticed a couple of potential issues in the script that could lead to unexpected behavior, especially when dealing with spaces or special characters in directory names or script arguments.
Array Handling:
In the original script, the array was defined as:
While this works in most cases, it can cause issues if any of the array elements contain spaces or special characters. I updated this to:
This ensures each element is treated as a distinct array item, even when it includes spaces or special characters.
Safe Argument Passing:
Another issue I found was with the
$@
usage. In the original version, arguments were passed to thecargo publish
command like this:cargo publish $@
Without quotes around
$@
, any arguments containing spaces or special characters could be misinterpreted. I fixed it by adding quotes:cargo publish "$@"
This change ensures that all arguments are passed correctly to the command, regardless of their content.
These adjustments should make the script more robust and prevent potential issues when dealing with various file and argument formats.