mirror of
https://git.dn42.dev/dn42/registry.git
synced 2025-05-06 12:45:21 +08:00
fix json decode issue
This commit is contained in:
parent
115a39f2b0
commit
28d12eb224
3 changed files with 6 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
set -eo pipefail
|
||||
|
||||
if [ "$#" -eq "0" ]
|
||||
then
|
||||
|
@ -19,15 +20,3 @@ cd "$BASE" || exit 1
|
|||
|
||||
utils/schema-check/dn42-schema.py -v scan data/ $MNT || ( echo "Schema validation failed, please check above!" ; exit 1 )
|
||||
|
||||
exit 0
|
||||
|
||||
git diff --cached --name-only | while IFS='/' read -ra LINE; do
|
||||
if [[ "${LINE[0]}" = "data" ]]; then
|
||||
if ! utils/schema-check/dn42-schema.py policy ${LINE[1]} ${LINE[2]} $MNT; then
|
||||
echo "# This file fails policy checks. To continue with the commit revert the change."
|
||||
echo "# git reset HEAD -- " ${LINE[1]}/${LINE[1]}/${LINE[2]}
|
||||
echo "# git checkout -- " ${LINE[1]}/${LINE[1]}/${LINE[2]}
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
set -eo pipefail
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
|
|
|
@ -374,7 +374,10 @@ def http_get(server, url, query=None, headers=None):
|
|||
if "application/json" in req.getheader("Content-Type", "application/json"):
|
||||
if req.status > 299:
|
||||
return {}
|
||||
return json.loads(req.read())
|
||||
r = req.read()
|
||||
if not isinstance(r, str):
|
||||
r = r.decode("utf-8")
|
||||
return json.loads(r)
|
||||
|
||||
if req.status > 299:
|
||||
return ""
|
||||
|
|
Loading…
Add table
Reference in a new issue