Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter 2024-11-25 09:09:39 +01:00
parent 88b0263bb8
commit 49543518f0

View file

@ -54,7 +54,7 @@ func (f *Fs) shouldRetryChunk(ctx context.Context, resp *http.Response, err erro
return f.shouldRetry(ctx, resp, err)
}
func (u *Uploader) uploadChunck(ctx context.Context, body io.Reader, size int64, offset int64, options ...fs.OpenOption) (int64, error) {
func (u *Uploader) uploadChunk(ctx context.Context, body io.Reader, size int64, offset int64, options ...fs.OpenOption) (int64, error) {
var method string
if !u.overridePatchMethod {
@ -110,7 +110,7 @@ func (u *Uploader) Upload(ctx context.Context, options ...fs.OpenOption) error {
fs.Debug(u.fs, "Uploaded starts")
for u.offset < u.upload.size && !u.aborted {
err := u.UploadChunck(ctx, cnt, options...)
err := u.UploadChunk(ctx, cnt, options...)
cnt++
if err != nil {
return err
@ -121,8 +121,8 @@ func (u *Uploader) Upload(ctx context.Context, options ...fs.OpenOption) error {
return nil
}
// UploadChunck uploads a single chunck.
func (u *Uploader) UploadChunck(ctx context.Context, cnt int, options ...fs.OpenOption) error {
// UploadChunk uploads a single chunk.
func (u *Uploader) UploadChunk(ctx context.Context, cnt int, options ...fs.OpenOption) error {
chunkSize := u.fs.opt.ChunkSize
data := make([]byte, chunkSize)
@ -142,7 +142,7 @@ func (u *Uploader) UploadChunck(ctx context.Context, cnt int, options ...fs.Open
body := bytes.NewBuffer(data[:size])
newOffset, err := u.uploadChunck(ctx, body, int64(size), u.offset, options...)
newOffset, err := u.uploadChunk(ctx, body, int64(size), u.offset, options...)
if err == nil {
fs.Debugf(u.fs, "Uploaded chunk no %d ok, range %d -> %d", cnt, u.offset, newOffset)