Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion arcup/arcup
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,9 @@ verify_checksum_file() {
local archive_name="$3"
local expected_checksum expected_name actual_checksum

if ! read -r expected_checksum expected_name < "$checksum_path"; then
read -r expected_checksum expected_name < "$checksum_path" || true

if [[ -z "$expected_checksum" ]]; then
error "Checksum file is empty: $checksum_path"
fi

Expand Down
7 changes: 7 additions & 0 deletions arcup/test_arcup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ test_checksum_validation() {

printf '%s other-asset.tar.gz\n' "$checksum" > "$checksum_file"
expect_fail "checksum filename mismatch fails" verify_checksum_file "$archive" "$checksum_file" "$archive_name"

printf '%s %s' "$checksum" "$archive_name" > "$checksum_file"
verify_checksum_file "$archive" "$checksum_file" "$archive_name"
pass "valid checksum file without trailing newline passes"

printf '' > "$checksum_file"
expect_fail "empty checksum file fails" verify_checksum_file "$archive" "$checksum_file" "$archive_name"
}

test_download_error_lists_assets() {
Expand Down
Loading