Skip to content

Commit 132629c

Browse files
authored
fix(compute): ensure trailing newline in fetched discovery doc (#16407)
1 parent fd8e805 commit 132629c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

generator/discovery/update_discovery_doc.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ if ! curl -fsSL "${COMPUTE_DISCOVERY_DOCUMENT_URL}" >"${TEMP_JSON}"; then
101101
exit 1
102102
fi
103103

104+
# Ensure the discovery document ends with a trailing newline.
105+
if [[ -s "${TEMP_JSON}" && -n "$(tail -c 1 "${TEMP_JSON}")" ]]; then
106+
echo >>"${TEMP_JSON}"
107+
fi
108+
104109
REVISION=$(sed -En 's/ \"revision\": \"([[:digit:]]+)\",/\1/p' "${TEMP_JSON}")
105110
if [[ -z "${REVISION}" ]]; then
106111
io::log_red "Could not parse revision from fetched discovery document."

0 commit comments

Comments
 (0)