Ask for a new name if the name is forbidden
1 files changed, 10 insertions(+), 1 deletions(-)

M invertbucket
M invertbucket +10 -1
@@ 314,7 314,16 @@ do_repo() (
 	then
 		printf "Failed to create %s repository:\n" "$host" >&2
 		printf '%s' "$resp" | jq . >&2
-		return 1
+        if echo "$resp" | grep -q "Name must match"; then
+            echo 'Please choose a new name that matches the requirements:'
+            read -r name
+            # repeating the request with the new name
+	        resp=$(srhtreq POST "$url" \
+		                   -H "Content-Type: application/json" \
+		                   -d'{"name": "'"$name"'", "visibility": "'$visibility'", "description": '"$desc"'}')
+        else
+		    return 1
+        fi
 	fi
 	srht_name=$(jqget "$resp" .name)
 	srht_owner=$(jqget "$resp" .owner.canonical_name)