1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-07 11:03:15 +00:00

multipart wip mk2

This commit is contained in:
dougal
2025-12-17 14:20:29 +00:00
parent 672d9469eb
commit f7f32d1a7c
3 changed files with 20 additions and 11 deletions

View File

@@ -161,10 +161,12 @@ type CopyResponse struct {
// MultiPartCreateRequest is the input of POST /s3/multipart/create
type MultiPartCreateRequest struct {
Filename string `json:"filename"`
Mime string `json:"mime"`
Size int64 `json:"size"`
Extension string `json:"extension"`
Filename string `json:"filename"`
Mime string `json:"mime"`
Size int64 `json:"size"`
Extension string `json:"extension"`
ParentID json.Number `json:"parent_id"`
RelativePath string `json:"relativePath"`
}
// MultiPartCreateResponse is returned by POST /s3/multipart/create

View File

@@ -1030,6 +1030,12 @@ type drimeChunkWriter struct {
// Pass in the remote and the src object
// You can also use options to hint at the desired chunk size
func (f *Fs) OpenChunkWriter(ctx context.Context, remote string, src fs.ObjectInfo, options ...fs.OpenOption) (info fs.ChunkWriterInfo, writer fs.ChunkWriter, err error) {
// Create the directory for the object if it doesn't exist
leaf, directoryID, err := f.dirCache.FindPath(ctx, remote, true)
if err != nil {
return info, nil, err
}
// Temporary Object under construction
o := &Object{
fs: f,
@@ -1056,10 +1062,12 @@ func (f *Fs) OpenChunkWriter(ctx context.Context, remote string, src fs.ObjectIn
// Initiate multipart upload
req := api.MultiPartCreateRequest{
Filename: f.opt.Enc.FromStandardName(path.Base(remote)),
Mime: fs.MimeType(ctx, src),
Size: size,
Extension: f.opt.Enc.FromStandardName(path.Ext(remote)),
Filename: leaf,
Mime: fs.MimeType(ctx, src),
Size: size,
Extension: strings.TrimPrefix(path.Ext(leaf), `.`),
ParentID: json.Number(directoryID),
RelativePath: f.opt.Enc.FromStandardPath(path.Join(f.root, remote)),
}
var resp api.MultiPartCreateResponse
@@ -1168,7 +1176,6 @@ func (s *drimeChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, read
// Get ETag from response
etag := uploadRes.Header.Get("ETag")
etag = strings.Trim(etag, `"`)
fs.CheckClose(uploadRes.Body, &err)
s.completedPartsMu.Lock()

View File

@@ -10,8 +10,8 @@ versionIntroduced: "v1.73"
on fast, resilient file delivery. It offers both free and paid tiers with
emphasis on high-speed uploads and link sharing.
The setup Drime you need to log in, go to settings, developer and create
token to make an API access key. Give it a sensible name and copy the token
The setup Drime you need to log in, go to Settings, Developer, and create a
token to use as an API access key. Give it a sensible name and copy the token
for use in the config.
## Configuration