分段上传期间AWS Glacier Golang校验和存在问题

时间:2019-12-11 17:49:44

标签: amazon-web-services go aws-sdk amazon-glacier

尝试完成AWS Glacier分段上传时,出现此错误:

Invalid x-amz-sha256-tree-hash: cd75dd9eca76a86dda2479831bf470d053195d5185c4da45be694e3cffd308a7

当我从命令行在文件上运行sha256sum时,它会返回相同的校验和:

cd75dd9eca76a86dda2479831bf470d053195d5185c4da45be694e3cffd308a7 ./test.mp4

我在这里做什么错了?

我正在生成校验和并像这样完成上传:

    h := sha256.New()

    _, err = io.Copy(h, bytes.NewReader(dat))
    if err != nil {
        log.Fatal(err)
    }

    checksum := fmt.Sprintf("%x", h.Sum(nil))
// This displays: Checksum:cd75dd9eca76a86dda2479831bf470d053195d5185c4da45be694e3cffd308a7
    fmt.Println("Checksum: ", checksum) 


    _, err = glacierClient.CompleteMultipartUpload(&glacier.CompleteMultipartUploadInput{
        AccountId:   aws.String("-"),
        UploadId:    initiateResult.UploadId,
        VaultName:   aws.String("some-test-vibrant-glacier-vault"),
        ArchiveSize: aws.String(fmt.Sprintf("%d", len(dat))),
        Checksum:    aws.String(checksum),
    })

0 个答案:

没有答案