diff --git a/lib/md_tools.sh b/lib/md_tools.sh index 9b90219..0b5fa9b 100755 --- a/lib/md_tools.sh +++ b/lib/md_tools.sh @@ -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 @@ -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 @@ -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 +# Usage: construct_mdq_url # # 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 () { @@ -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 #