Skip to content

Commit 7d3ec9e

Browse files
authored
fix: use raw file input for reading files
Signed-off-by: matttrach <matt.trachier@suse.com>
1 parent 36bf637 commit 7d3ec9e

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

modules/persist_file/read_file.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,4 @@ set -e
44
JSON_INPUT="$(jq -r '.')"
55
FILEPATH="$(jq -r '.filepath' <<<"$JSON_INPUT")"
66

7-
DATA=""
8-
if [ -n "$FILEPATH" ]; then
9-
if [ -f "$FILEPATH" ]; then
10-
DATA="$(cat "$FILEPATH")"
11-
fi
12-
fi
13-
14-
jq -n --arg data "$DATA" '{"data": $data}'
7+
jq -n --rawfile data "$FILEPATH" '{"data": $data}' 2>/dev/null || jq -n '{"data":"error"}'

0 commit comments

Comments
 (0)