Skip to content

Commit

Permalink
fix alipan internal upload
Browse files Browse the repository at this point in the history
  • Loading branch information
v2wy committed Jan 20, 2024
1 parent 4f7761f commit 50a6e44
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/aliyundrive_open/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"math"
"net/http"
"net/url"
"strconv"
"strings"

Check failure on line 13 in drivers/aliyundrive_open/upload.go

View workflow job for this annotation

GitHub Actions / Build Docker

"strings" imported and not used

Check failure on line 13 in drivers/aliyundrive_open/upload.go

View workflow job for this annotation

GitHub Actions / Build Docker

"strings" imported and not used

Check failure on line 13 in drivers/aliyundrive_open/upload.go

View workflow job for this annotation

GitHub Actions / Build Docker

"strings" imported and not used

Check failure on line 13 in drivers/aliyundrive_open/upload.go

View workflow job for this annotation

GitHub Actions / Build Docker

"strings" imported and not used

Check failure on line 13 in drivers/aliyundrive_open/upload.go

View workflow job for this annotation

GitHub Actions / Build Docker

"strings" imported and not used

Check failure on line 13 in drivers/aliyundrive_open/upload.go

View workflow job for this annotation

GitHub Actions / Build Docker

"strings" imported and not used
"time"
Expand Down Expand Up @@ -67,7 +68,14 @@ func (d *AliyundriveOpen) getUploadUrl(count int, fileId, uploadId string) ([]Pa
func (d *AliyundriveOpen) uploadPart(ctx context.Context, r io.Reader, partInfo PartInfo) error {
uploadUrl := partInfo.UploadUrl
if d.InternalUpload {
uploadUrl = strings.ReplaceAll(uploadUrl, "https://cn-beijing-data.aliyundrive.net/", "http://ccp-bj29-bj-1592982087.oss-cn-beijing-internal.aliyuncs.com/")
parsedURL, err := url.Parse(uploadUrl)
if err != nil {
return err
}
parsedURL.Scheme = "http"
parsedURL.Host = "ccp-bj29-bj-1592982087.oss-cn-beijing-internal.aliyuncs.com"

uploadUrl = parsedURL.String()
}
req, err := http.NewRequestWithContext(ctx, "PUT", uploadUrl, r)
if err != nil {
Expand Down

0 comments on commit 50a6e44

Please sign in to comment.