b2 upload-file --sha1 <hash> gives no error when receives wrong hash.

Đang mở
#478 11 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Start with the b2 upload-file command and its --sha1 option, and compare the behaviour in the issue with the help text quoted there. The open question is whether the tool should compare the supplied hash with the one the server computes, or only document that it skips computing it. Done means a decision on that question, and then either a clear error on mismatch or a clarified help string. Confirm the decision with the maintainers first, since the thread has been silent for about seven years.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug help wanted

I'm trying to automate some single-file backup tasks, and I've found that while the web API apparently works, I don't know how much I can trust the b2 CLI.

When I call the function with the correct SHA1 as argument:

b2 upload-file --sha1 f871a33490af899cf5476c002c513d1bc4e537b9 futuroapiteste test_file.txt test_file_b2_cli.txt
test_file.txt: 100%|██████████████████████████████████████████████████████████| 5.52k/5.52k [00:01<00:00, 5.42kB/s]
URL by file name: https://f002.backblazeb2.com/file/futuroapiteste/test_file_b2_cli.txt
URL by fileId: https://f002.backblazeb2.com/b2api/v1/b2_download_file_by_id?fileId=4_zeee396220d1bff11694a0a1d_f107a92e113ff0c11_d20180731_m193133_c002_v0001095_t0024
{
"action": "upload",
"fileId": "4_zeee396220d1bff11694a0a1d_f107a92e113ff0c11_d20180731_m193133_c002_v0001095_t0024",
"fileName": "arquivo_teste_b2_cli.txt",
"size": 5520,
"uploadTimestamp": 1533065493000
}

======================================================

When I call the function with the wrong SHA1 as argument:

b2 upload-file --sha1 1111111111111111111111111111111111111111 futuroapiteste test_file.txt test_file_b2_cli_wrong_sha1.txt
test_file.txt: 100%|██████████████████████████████████████████████████████████| 5.52k/5.52k [00:00<00:00, 6.10kB/s]
URL by file name: https://f002.backblazeb2.com/file/futuroapiteste/test_file_b2_cli_wrong_sha1.txt
URL by fileId: https://f002.backblazeb2.com/b2api/v1/b2_download_file_by_id?fileId=4_zeee396220d1bff11694a0a1d_f116da3bb244871bc_d20180731_m193245_c002_v0001094_t0044
{
"action": "upload",
"fileId": "4_zeee396220d1bff11694a0a1d_f116da3bb244871bc_d20180731_m193245_c002_v0001094_t0044",
"fileName": "arquivo_teste_b2_cli_wrong_sha1.txt",
"size": 5520,
"uploadTimestamp": 1533065565000
}

=======================================================
Using:
b2 command line tool, version 1.3.0

When I use b2 list-file-names, it shows me that b2 has the correct SHA1 for both files, which shows that the upload happened well, but then -
Did it check the hash I submitted?
If yes, why there was no error?
(Maybe it recalculated the hash anyway before submitting...?)
(Does b2 upload-file already compare the locally created hash with the hash b2 calculates and returns when the file gets there...? )

The built-in CLI help states:

"By default, upload_file will compute the sha1 checksum of the file
to be uploaded. But, if you already have it, you can provide it
on the command line to save a little time."

Which seems to suggest it does, but it doesn't explicitly say it compares, just 'computes', and the behavior would suggest otherwise.

Ngôn ngữ chính
Python
Star
638
Fork
138
Merge trung bình
8 giờ 27 phút
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Backblaze/B2_Command_Line_Tool

Tất cả issue của Backblaze/B2_Command_Line_Tool

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.