Skip to content

Commit

Permalink
Deprecate urlencode function
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Scavo committed Jan 14, 2017
1 parent 58ff4b1 commit a5525ce
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/md_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ getEntityFromServer () {
return 2
fi

# external dependency
if [ "$(type -t percent_encode)" != function ]; then
echo "ERROR: $FUNCNAME: function percent_encode not found" >&2
return 2
fi

local tmp_dir
local mdq_base_url
local tmp_response_file
Expand Down Expand Up @@ -177,11 +183,11 @@ getEntityFromServer () {
fi
entityID=$1

# URL-encode the identifier
encoded_id=$( urlencode $entityID )
# percent-encode the identifier
encoded_id=$( percent_encode $entityID )
return_status=$?
if [ "$return_status" -ne 0 ]; then
echo "ERROR: $FUNCNAME: failed to URL-encode the entityID: $entityID" >&2
echo "ERROR: $FUNCNAME: failed to percent-encode the entityID: $entityID" >&2
return 3
fi

Expand Down Expand Up @@ -222,10 +228,11 @@ getEntityFromServer () {
# Construct a request URL per the MDQ Protocol specification.
# See: https://github.com/iay/md-query
#
# Usage: construct_mdq_url <base_url> <url_encoded_id>
# Usage: construct_mdq_url <base_url> <percent_encoded_id>
#
# To construct a reference to ALL entities served by the
# metadata query server, simply omit the second argument
# metadata query server, simply omit the second argument.
# (Note: Not all MDQ servers serve such an aggregate.)
#######################################################################
construct_mdq_url () {

Expand All @@ -251,6 +258,8 @@ construct_mdq_url () {
}

#######################################################################
# This function is DEPRECATED. Use percent_encode instead.
#
# URL-encode an arbitrary string.
# See: https://gist.github.com/cdown/1163649
#
Expand Down

0 comments on commit a5525ce

Please sign in to comment.