Skip to content

Commit

Permalink
fix: parser to work with forward slashes in ref param (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
DzeryCZ authored and aslafy-z committed Nov 11, 2020
1 parent 17363a4 commit 00697dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions helm-git-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ main() {

readonly git_repo=$(echo "$_raw_uri" | sed -E 's#^([^/]+//[^/]+[^@\?]+)@?[^@\?]+\??.*$#\1#')
# TODO: Validate git_repo
readonly git_path=$(echo "$_raw_uri" | sed -E 's#.*@([^?]*)\/.*#\1#')
readonly git_path=$(echo "$_raw_uri" | sed -E 's#.*@([^\?]+)\/([^\?]+).*(\?.*)?#\1#')
# TODO: Validate git_path
readonly helm_file=$(echo "$_raw_uri" | sed -E 's#.*@[^?]*\/([^?]*).*#\1#')
readonly helm_file=$(echo "$_raw_uri" | sed -E 's#.*@([^\?]+)\/([^\?]+).*(\?.*)?#\2#')

git_ref=$(echo "$_raw_uri" | sed '/^.*ref=\([^&#]*\).*$/!d;s//\1/')
# TODO: Validate git_ref
Expand Down
2 changes: 1 addition & 1 deletion tests/04-uri-validation.bats
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ load 'test-helper'
}

@test "should success with forward slash in ref" {
_run_helm_git "git+https://github.com/jaroslaw-osmanski/helm-git-test@/index.yaml?ref=feature/feature-test"
_run_helm_git "git+https://github.com/jaroslaw-osmanski/helm-git-test@test-chart/index.yaml?ref=feature/feature-test"
[ $status = 0 ]
}

0 comments on commit 00697dd

Please sign in to comment.