1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 11:31:54 +08:00

files2.0: updates for file type split

License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
Łukasz Magiera
2018-11-19 03:24:42 +01:00
parent a43f2f85b8
commit adc7490755
21 changed files with 294 additions and 229 deletions

View File

@ -391,9 +391,12 @@ And then run:
return err
}
_, input, err := req.Files.NextFile()
if err != nil && err != io.EOF {
return err
it, _ := req.Files.Entries()
if !it.Next() && it.Err() != nil {
return it.Err()
}
if it.File() == nil {
return fmt.Errorf("expected a regular file")
}
inputenc, _ := req.Options["inputenc"].(string)
@ -411,7 +414,7 @@ And then run:
return err
}
p, err := api.Object().Put(req.Context, input,
p, err := api.Object().Put(req.Context, it.File(),
options.Object.DataType(datafieldenc),
options.Object.InputEnc(inputenc),
options.Object.Pin(dopin))