From 6e2a0c4229f498017e523b975e1ae41b98ad184b Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Wed, 23 Sep 2026 12:34:39 +0200 Subject: [PATCH] Update the LogDetective URL API call JSON schema. LogDetective's /analyze endpoint moved to a new JSON schema for submissions. Sending the old schema now gets rejected by the server, so failed builds only get an error back instead of a log analysis. Build the payload with `jq -n` instead of interpolating into a string, since jq is already a dependency of this function and it escapes the filename and URL correctly if either contains quotes or backslashes. Assisted-by: Claude Sonnet 5 --- common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common.sh b/common.sh index 8fab1db2..03a68e33 100644 --- a/common.sh +++ b/common.sh @@ -24,8 +24,9 @@ analyze_logs_by_logdetective() { echo "Sending log file to logdetective server: ${raw_paste_bin_link}" echo "-------- LOGDETECTIVE TEST LOG ANALYSIS START --------" logdetective_test_file=$(mktemp "/tmp/logdetective_test.XXXXXX") + logdetective_request_data=$(jq -n --arg name "$(basename "$log_file_name")" --arg url "$raw_paste_bin_link" '{files: [{name: $name, url: $url}]}') # shellcheck disable=SC2181 - if ! curl -k --insecure --header "Content-Type: application/json" --request POST --data "{\"url\":\"${raw_paste_bin_link}\"}" "$LOGDETECTIVE_SERVER/analyze" >> "${logdetective_test_file}"; then + if ! curl -k --insecure --header "Content-Type: application/json" --request POST --data "${logdetective_request_data}" "$LOGDETECTIVE_SERVER/analyze" >> "${logdetective_test_file}"; then echo "ERROR: Failed to analyze log file by logdetective server." cat "${logdetective_test_file}" echo "-------- LOGDETECTIVE TEST LOG ANALYSIS FAILED --------"