diff --git a/backend/drime/api/types.go b/backend/drime/api/types.go index c9bf50699..5d5855102 100644 --- a/backend/drime/api/types.go +++ b/backend/drime/api/types.go @@ -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 diff --git a/backend/drime/drime.go b/backend/drime/drime.go index a8949a31c..01d392b36 100644 --- a/backend/drime/drime.go +++ b/backend/drime/drime.go @@ -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() diff --git a/docs/content/drime.md b/docs/content/drime.md index f895a25ba..d1cb4cacf 100644 --- a/docs/content/drime.md +++ b/docs/content/drime.md @@ -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