GithubHelp home page GithubHelp logo

rust-sdk's People

Contributors

bachue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

deliangyang

rust-sdk's Issues

使用 FileUploaderBuilder::upload_stream() 上传空文件报错 parts param can't be empty

使用 upload_stream() 上传空文件的代码如下:

let config = Config::default();
let upload_policy = UploadPolicyBuilder::new_policy_for_bucket("xxx", &config)
    .build();
let access_key = "xxx";
let secret_key = "xxx";
let credential = Credential::new(access_key, secret_key);
let upload_token = UploadToken::new(upload_policy, &credential);
let upload_manager = UploadManager::new(config);
println!("{:?}", upload_manager.for_upload_token(upload_token)?
    .key("abc")
    .upload_stream(&vec![][..], 0, "1.txt", None));

执行结果是

Err(QiniuError(Error {
  retry_kind: UnretryableError,
  error_kind: ResponseStatusCodeError(400, "parts param can\'t be empty"),
  method: Some(POST),
  url: Some("https://upload-z2.qiniup.com/buckets/xxx/objects/xxx/uploads/5e7c5f4b29a4714baa3e5a5e"),
  request_id: Some("-ZoAAACWVcVVy_8V"), is_retry_safe: false }))

而使用 upload_file() 上传空文件不会报错:

// 1.txt 是一个空文件
let local_file_path = Path::new("1.txt");
let upload_manager = UploadManager::new(config);
println!("{:?}", upload_manager.for_upload_token(upload_token)?
    .key("abc")
    .upload_file(local_file_path, "1.txt", None));

上面的代码可以正常上传空文件。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.