Skip to content

Commit 172be19

Browse files
committed
resolve merge conflicts after squash merge from main
1 parent 5df71e5 commit 172be19

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed

drivers/123_open/driver.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ func (d *Open123) Put(ctx context.Context, dstDir model.Obj, file model.FileStre
225225
return nil, fmt.Errorf("upload complete timeout")
226226
}
227227

228-
<<<<<<< HEAD
229-
// Preup 预上传
228+
// Preup handles pre-upload initialization for slice upload
230229
func (d *Open123) Preup(ctx context.Context, srcobj model.Obj, req *reqres.PreupReq) (*model.PreupInfo, error) {
231230
pid, err := strconv.ParseUint(srcobj.GetID(), 10, 64)
232231
if err != nil {
@@ -257,21 +256,21 @@ func (d *Open123) Preup(ctx context.Context, srcobj model.Obj, req *reqres.Preup
257256
}, nil
258257
}
259258

260-
// UploadSlice 上传分片
259+
// SliceUpload handles individual slice upload
261260
func (d *Open123) SliceUpload(ctx context.Context, req *tables.SliceUpload, sliceno uint, fd io.Reader) error {
262261
sh := strings.Split(req.SliceHash, ",")
263262
if int(sliceno) >= len(sh) {
264263
return fmt.Errorf("slice number %d out of range, total slices: %d", sliceno, len(sh))
265264
}
266-
265+
267266
if req.PreupID == "" {
268267
return fmt.Errorf("preupload ID is empty for slice %d", sliceno)
269268
}
270-
269+
271270
if req.Server == "" {
272271
return fmt.Errorf("upload server is empty for slice %d", sliceno)
273272
}
274-
273+
275274
r := &UploadSliceReq{
276275
Name: req.Name,
277276
PreuploadID: req.PreupID,
@@ -280,26 +279,26 @@ func (d *Open123) SliceUpload(ctx context.Context, req *tables.SliceUpload, slic
280279
SliceMD5: sh[sliceno],
281280
SliceNo: int(sliceno) + 1,
282281
}
283-
282+
284283
if err := d.uploadSlice(r); err != nil {
285284
return fmt.Errorf("upload slice %d failed: %w", sliceno, err)
286285
}
287286
return nil
288287
}
289288

290-
// UploadSliceComplete 分片上传完成
289+
// UploadSliceComplete finalizes slice upload process
290+
// UploadSliceComplete finalizes slice upload process
291291
func (d *Open123) UploadSliceComplete(ctx context.Context, su *tables.SliceUpload) error {
292292
if su.PreupID == "" {
293293
return fmt.Errorf("preupload ID is empty")
294294
}
295-
295+
296296
if err := d.sliceUpComplete(su.PreupID); err != nil {
297297
return fmt.Errorf("slice upload complete failed: %w", err)
298298
}
299299
return nil
300300
}
301301

302-
=======
303302
func (d *Open123) GetDetails(ctx context.Context) (*model.StorageDetails, error) {
304303
userInfo, err := d.getUserInfo()
305304
if err != nil {
@@ -315,6 +314,5 @@ func (d *Open123) GetDetails(ctx context.Context) (*model.StorageDetails, error)
315314
}, nil
316315
}
317316

318-
>>>>>>> origin/main
319317
var _ driver.Driver = (*Open123)(nil)
320318
var _ driver.PutResult = (*Open123)(nil)

drivers/baidu_netdisk/driver.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ func (d *BaiduNetdisk) uploadSlice(ctx context.Context, params map[string]string
378378
return nil
379379
}
380380

381-
<<<<<<< HEAD
382381
// SliceUpload 上传分片
383382
func (d *BaiduNetdisk) SliceUpload(ctx context.Context, req *tables.SliceUpload, sliceno uint, fd io.Reader) error {
384383
fp := filepath.Join(req.DstPath, req.Name)
@@ -405,11 +404,11 @@ func (d *BaiduNetdisk) SliceUpload(ctx context.Context, req *tables.SliceUpload,
405404
}
406405
req.PreupID = precreateResp.Uploadid
407406
}
408-
407+
409408
if req.PreupID == "" {
410409
return fmt.Errorf("preupload ID is empty for slice %d", sliceno)
411410
}
412-
411+
413412
err := d.uploadSlice(ctx, map[string]string{
414413
"method": "upload",
415414
"access_token": d.AccessToken,
@@ -418,7 +417,7 @@ func (d *BaiduNetdisk) SliceUpload(ctx context.Context, req *tables.SliceUpload,
418417
"uploadid": req.PreupID,
419418
"partseq": strconv.Itoa(int(sliceno)),
420419
}, req.Name, fd)
421-
420+
422421
if err != nil {
423422
return fmt.Errorf("upload slice %d failed: %w", sliceno, err)
424423
}
@@ -437,36 +436,36 @@ func (d *BaiduNetdisk) UploadSliceComplete(ctx context.Context, su *tables.Slice
437436
fp := filepath.Join(su.DstPath, su.Name)
438437
rsp := &SliceUpCompleteResp{}
439438
t := time.Now().Unix()
440-
439+
441440
sliceHashList := strings.Split(su.SliceHash, ",")
442441
if len(sliceHashList) == 0 {
443442
return fmt.Errorf("slice hash list is empty")
444443
}
445-
444+
446445
sh, err := json.Marshal(sliceHashList)
447446
if err != nil {
448447
return fmt.Errorf("failed to marshal slice hash: %w", err)
449448
}
450-
449+
451450
b, err := d.create(fp, int64(su.Size), 0, su.PreupID, string(sh), rsp, t, t)
452451
if err != nil {
453452
log.Errorf("create file failed: %v, response: %v, body: %s", err, rsp, string(b))
454453
return fmt.Errorf("create file failed: %w", err)
455454
}
456-
455+
457456
if rsp.Errno != 0 {
458457
return fmt.Errorf("baidu response error: errno=%d", rsp.Errno)
459458
}
460-
459+
461460
return nil
462-
=======
461+
}
462+
463463
func (d *BaiduNetdisk) GetDetails(ctx context.Context) (*model.StorageDetails, error) {
464464
du, err := d.quota()
465465
if err != nil {
466466
return nil, err
467467
}
468468
return &model.StorageDetails{DiskUsage: *du}, nil
469-
>>>>>>> origin/main
470469
}
471470

472471
var _ driver.Driver = (*BaiduNetdisk)(nil)

drivers/baidu_netdisk/types.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ type PrecreateResp struct {
190190
File File `json:"info"`
191191
}
192192

193-
<<<<<<< HEAD
194193
// PrecreateReq 预上传请求
195194
type PrecreateReq struct {
196195
Path string `json:"path"` // 上传后使用的文件绝对路径(需urlencode)
@@ -235,13 +234,13 @@ type SliceUpCompleteResp struct {
235234
Ctime uint64 `json:"ctime"` // 文件创建时间
236235
Mtime uint64 `json:"mtime"` // 文件修改时间
237236
Isdir int `json:"isdir"` // 是否目录,0 文件、1 目录
238-
=======
237+
}
238+
239239
type QuotaResp struct {
240240
Errno int `json:"errno"`
241241
RequestId int64 `json:"request_id"`
242242
Total uint64 `json:"total"`
243243
Used uint64 `json:"used"`
244244
//Free uint64 `json:"free"`
245245
//Expire bool `json:"expire"`
246-
>>>>>>> origin/main
247246
}

0 commit comments

Comments
 (0)