相关疑难解决方法(0)

538
推荐指数
7
解决办法
48万
查看次数

可恢复上传到 GCS Google Cloud Storage 签名 url 的内容已损坏

我正在尝试使用 Postman 模拟可恢复上传到 GCS 签名 url 以执行两个 PUT 以查看它是如何工作的。

参考几个帖子后:

我可以使用 Google Cloud Storage 签名 URL 进行可恢复上传吗?

使用签名网址上传到 Google Cloud

如何使用带有签名 url 的 gcs-resumable-upload

我终于成功了并成功恢复了 200 OK,但文件已损坏。以下是步骤:

0)。POST 到我们的服务器(运行 NodeJS 8.11)以获取带有 action=="resumable" 的存储桶签名 url。服务器代码是:

      const file = bucket.file(fileName);
      const config = {
        action: 'resumable',
        version: 'v4',
        expires,
        contentType
      };
      file.getSignedUrl( config, (error, url) => {
        if (error) return reject(error);
        resolve(url);
      });
Run Code Online (Sandbox Code Playgroud)

这将返回签名网址

https://storage.googleapis.com/<bucket_name/<path_to_file>?GoogleAccessId=<service_account>&Expires=<expiry_time>&Signature=<signature>

1)。POST 到带有标题{ 'x-goog-resumable': 'start' }和空正文的签名网址。我取回了创建的 HTTP 201,以及与签名 URL 相同的值的“Location”标头,加上&upload_id=AEnB2UqIJL_jf.....末尾的 …

google-cloud-storage pre-signed-url resumable

5
推荐指数
0
解决办法
779
查看次数