Skip to content

Commit

Permalink
Merge pull request #102 from aksm/ISSUE-101
Browse files Browse the repository at this point in the history
ISSUE-101: import_export.sh script encoding/escaping bug
  • Loading branch information
DiegoPino authored Feb 26, 2023
2 parents 3f8a9aa + abc988f commit 5c49dd5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion drupal/scripts/archipelago/import_export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ Help()
echo
}

if ! command -v jq &> /dev/null
then
echo "jq command could not be found. Please install or configure jq."
exit
fi

if ! command -v json_pp &> /dev/null
then
echo "json_pp command could not be found. Please install or configure json_pp."
exit
fi

script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
adl_env_file="$script_dir/../../../deploy/ec2-docker/.env"
ad_env_file="$script_dir/../../.env"
Expand Down Expand Up @@ -120,7 +132,7 @@ export_data() {
curl -w "\n" -H 'Accept: application/vnd.api+json' -H 'Content-type: application/vnd.api+json' -K - "$json_api_endpoint" <<< "user = \"$username:$password\"" | jq -cr '.data[]|del(.links)|del(.relationships)|del(.attributes.created)|del(.attributes.drupal_internal__id)|del(.attributes.changed)|del(.attributes.link)|{"data": .}' | while read -r metadatadisplay_entity;
do
uuid=$(echo "$metadatadisplay_entity" | jq -r .data.id)
echo "$metadatadisplay_entity" >> "metadatadisplay_entity_$uuid.json"
echo "$metadatadisplay_entity" | json_pp -json_opt escape_slash >> "metadatadisplay_entity_$uuid.json"
done
}
Expand Down

0 comments on commit 5c49dd5

Please sign in to comment.