Skip to content

Commit

Permalink
Bugfix: Path replacement regex not working (#6580)
Browse files Browse the repository at this point in the history
A previous change to make the regex a variable to allow proper linting
resulted in the regexp not having access to the value associated with
the variable and the path variable not being replaced.

Moves the regexp variable inside the for loop to allow the value to be
used and the path variable to be replaced with the provided value.
  • Loading branch information
kenjones-cisco authored and wing328 committed Sep 28, 2017
1 parent d04b764 commit 87a9caa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ build_request_path() {
fi

# First replace all path parameters in the path
local path_regex="(.*)(\\{$pparam\\})(.*)"
for pparam in "${path_params[@]}"; do
local path_regex="(.*)(\\{$pparam\\})(.*)"
if [[ $path_template =~ $path_regex ]]; then
path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
fi
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/bash/petstore-cli
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,8 @@ build_request_path() {
fi

# First replace all path parameters in the path
local path_regex="(.*)(\\{$pparam\\})(.*)"
for pparam in "${path_params[@]}"; do
local path_regex="(.*)(\\{$pparam\\})(.*)"
if [[ $path_template =~ $path_regex ]]; then
path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
fi
Expand Down

0 comments on commit 87a9caa

Please sign in to comment.