feat(aliyundrive): internal upload (aliyun ECS for Beijing area only) (#3188)

Co-authored-by: wangwuxuan2011 <git@wangwuxuan.cn>
pull/3195/head
Wuxuan 2023-01-30 11:18:08 +08:00 committed by GitHub
parent c92e11dad5
commit e1cd71616d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -251,7 +251,11 @@ func (d *AliDrive) Put(ctx context.Context, dstDir model.Obj, stream model.FileS
if utils.IsCanceled(ctx) { if utils.IsCanceled(ctx) {
return ctx.Err() return ctx.Err()
} }
req, err := http.NewRequest("PUT", partInfo.UploadUrl, io.LimitReader(file, DEFAULT)) url := partInfo.UploadUrl
if d.InternalUpload {
url = partInfo.InternalUploadUrl
}
req, err := http.NewRequest("PUT", url, io.LimitReader(file, DEFAULT))
if err != nil { if err != nil {
return err return err
} }

View File

@ -11,6 +11,7 @@ type Addition struct {
OrderBy string `json:"order_by" type:"select" options:"name,size,updated_at,created_at"` OrderBy string `json:"order_by" type:"select" options:"name,size,updated_at,created_at"`
OrderDirection string `json:"order_direction" type:"select" options:"ASC,DESC"` OrderDirection string `json:"order_direction" type:"select" options:"ASC,DESC"`
RapidUpload bool `json:"rapid_upload"` RapidUpload bool `json:"rapid_upload"`
InternalUpload bool `json:"internal_upload"`
} }
var config = driver.Config{ var config = driver.Config{

View File

@ -48,7 +48,8 @@ type UploadResp struct {
FileId string `json:"file_id"` FileId string `json:"file_id"`
UploadId string `json:"upload_id"` UploadId string `json:"upload_id"`
PartInfoList []struct { PartInfoList []struct {
UploadUrl string `json:"upload_url"` UploadUrl string `json:"upload_url"`
InternalUploadUrl string `json:"internal_upload_url"`
} `json:"part_info_list"` } `json:"part_info_list"`
RapidUpload bool `json:"rapid_upload"` RapidUpload bool `json:"rapid_upload"`