Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: AlistGo/alist
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.20.0
Choose a base ref
...
head repository: AlistGo/alist
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.20.1
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 5, 2023

  1. Copy the full SHA
    e4c7b0f View commit details
  2. Copy the full SHA
    4fabc27 View commit details
  3. Copy the full SHA
    8bdc67e View commit details
Showing with 35 additions and 17 deletions.
  1. +1 −1 cmd/server.go
  2. +23 −16 drivers/aliyundrive_open/driver.go
  3. +7 −0 drivers/aliyundrive_share/driver.go
  4. +4 −0 server/webdav/webdav.go
2 changes: 1 addition & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ the address is defined in config file`,
}()
}
if conf.Conf.Scheme.HttpsPort != -1 {
httpsBase := fmt.Sprintf("%s:%d", conf.Conf.Scheme.Address, conf.Conf.Scheme.HttpPort)
httpsBase := fmt.Sprintf("%s:%d", conf.Conf.Scheme.Address, conf.Conf.Scheme.HttpsPort)
utils.Log.Infof("start HTTPS server @ %s", httpsBase)
httpsSrv = &http.Server{Addr: httpsBase, Handler: r}
go func() {
39 changes: 23 additions & 16 deletions drivers/aliyundrive_open/driver.go
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ package aliyundrive_open

import (
"context"
"fmt"
"io"
"math"
"net/http"
@@ -50,6 +51,9 @@ func (d *AliyundriveOpen) Drop(ctx context.Context) error {
}

func (d *AliyundriveOpen) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
if d.limitList == nil {
return nil, fmt.Errorf("driver not init")
}
files, err := d.getFiles(ctx, dir.GetID())
if err != nil {
return nil, err
@@ -79,6 +83,9 @@ func (d *AliyundriveOpen) link(ctx context.Context, file model.Obj) (*model.Link
}

func (d *AliyundriveOpen) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) {
if d.limitLink == nil {
return nil, fmt.Errorf("driver not init")
}
return d.limitLink(ctx, file)
}

@@ -148,9 +155,9 @@ func (d *AliyundriveOpen) Remove(ctx context.Context, obj model.Obj) error {
func (d *AliyundriveOpen) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) error {
// rapid_upload is not currently supported
// 1. create
// Part Size Unit: Bytes, Default: 20MB,
// Maximum number of slices 10,000, ≈195.3125GB
var partSize int64 = 20*1024*1024
// Part Size Unit: Bytes, Default: 20MB,
// Maximum number of slices 10,000, ≈195.3125GB
var partSize int64 = 20 * 1024 * 1024
createData := base.Json{
"drive_id": d.DriveId,
"parent_file_id": dstDir.GetID(),
@@ -160,19 +167,19 @@ func (d *AliyundriveOpen) Put(ctx context.Context, dstDir model.Obj, stream mode
}
count := 1
if stream.GetSize() > partSize {
if stream.GetSize() > 1*1024*1024*1024*1024 { // file Size over 1TB
partSize = 5*1024*1024*1024 // file part size 5GB
} else if stream.GetSize() > 768*1024*1024*1024 { // over 768GB
partSize = 109951163 // ≈ 104.8576MB, split 1TB into 10,000 part
} else if stream.GetSize() > 512*1024*1024*1024 { // over 512GB
partSize = 82463373 // ≈ 78.6432MB
} else if stream.GetSize() > 384*1024*1024*1024 { // over 384GB
partSize = 54975582 // ≈ 52.4288MB
} else if stream.GetSize() > 256*1024*1024*1024 { // over 256GB
partSize = 41231687 // ≈ 39.3216MB
} else if stream.GetSize() > 128*1024*1024*1024 { // over 128GB
partSize = 27487791 // ≈ 26.2144MB
}
if stream.GetSize() > 1*1024*1024*1024*1024 { // file Size over 1TB
partSize = 5 * 1024 * 1024 * 1024 // file part size 5GB
} else if stream.GetSize() > 768*1024*1024*1024 { // over 768GB
partSize = 109951163 // ≈ 104.8576MB, split 1TB into 10,000 part
} else if stream.GetSize() > 512*1024*1024*1024 { // over 512GB
partSize = 82463373 // ≈ 78.6432MB
} else if stream.GetSize() > 384*1024*1024*1024 { // over 384GB
partSize = 54975582 // ≈ 52.4288MB
} else if stream.GetSize() > 256*1024*1024*1024 { // over 256GB
partSize = 41231687 // ≈ 39.3216MB
} else if stream.GetSize() > 128*1024*1024*1024 { // over 128GB
partSize = 27487791 // ≈ 26.2144MB
}
count = int(math.Ceil(float64(stream.GetSize()) / float64(partSize)))
createData["part_info_list"] = makePartInfos(count)
}
7 changes: 7 additions & 0 deletions drivers/aliyundrive_share/driver.go
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ package aliyundrive_share

import (
"context"
"fmt"
"net/http"
"time"

@@ -65,6 +66,9 @@ func (d *AliyundriveShare) Drop(ctx context.Context) error {
}

func (d *AliyundriveShare) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
if d.limitList == nil {
return nil, fmt.Errorf("driver not init")
}
return d.limitList(ctx, dir)
}

@@ -79,6 +83,9 @@ func (d *AliyundriveShare) list(ctx context.Context, dir model.Obj) ([]model.Obj
}

func (d *AliyundriveShare) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) {
if d.limitLink == nil {
return nil, fmt.Errorf("driver not init")
}
return d.limitLink(ctx, file)
}

4 changes: 4 additions & 0 deletions server/webdav/webdav.go
Original file line number Diff line number Diff line change
@@ -71,6 +71,10 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
status, err = h.handleUnlock(brw, r)
case "PROPFIND":
status, err = h.handlePropfind(brw, r)
// if there is a error for PROPFIND, we should be as an empty folder to the client
if err != nil {
status = http.StatusNotFound
}
case "PROPPATCH":
status, err = h.handleProppatch(brw, r)
}