Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
8bdc67ec3d | |||
4fabc27366 | |||
e4c7b0f17c |
@ -56,7 +56,7 @@ the address is defined in config file`,
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
if conf.Conf.Scheme.HttpsPort != -1 {
|
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)
|
utils.Log.Infof("start HTTPS server @ %s", httpsBase)
|
||||||
httpsSrv = &http.Server{Addr: httpsBase, Handler: r}
|
httpsSrv = &http.Server{Addr: httpsBase, Handler: r}
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -2,6 +2,7 @@ package aliyundrive_open
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"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) {
|
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())
|
files, err := d.getFiles(ctx, dir.GetID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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) {
|
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)
|
return d.limitLink(ctx, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +157,7 @@ func (d *AliyundriveOpen) Put(ctx context.Context, dstDir model.Obj, stream mode
|
|||||||
// 1. create
|
// 1. create
|
||||||
// Part Size Unit: Bytes, Default: 20MB,
|
// Part Size Unit: Bytes, Default: 20MB,
|
||||||
// Maximum number of slices 10,000, ≈195.3125GB
|
// Maximum number of slices 10,000, ≈195.3125GB
|
||||||
var partSize int64 = 20*1024*1024
|
var partSize int64 = 20 * 1024 * 1024
|
||||||
createData := base.Json{
|
createData := base.Json{
|
||||||
"drive_id": d.DriveId,
|
"drive_id": d.DriveId,
|
||||||
"parent_file_id": dstDir.GetID(),
|
"parent_file_id": dstDir.GetID(),
|
||||||
@ -161,7 +168,7 @@ func (d *AliyundriveOpen) Put(ctx context.Context, dstDir model.Obj, stream mode
|
|||||||
count := 1
|
count := 1
|
||||||
if stream.GetSize() > partSize {
|
if stream.GetSize() > partSize {
|
||||||
if stream.GetSize() > 1*1024*1024*1024*1024 { // file Size over 1TB
|
if stream.GetSize() > 1*1024*1024*1024*1024 { // file Size over 1TB
|
||||||
partSize = 5*1024*1024*1024 // file part size 5GB
|
partSize = 5 * 1024 * 1024 * 1024 // file part size 5GB
|
||||||
} else if stream.GetSize() > 768*1024*1024*1024 { // over 768GB
|
} else if stream.GetSize() > 768*1024*1024*1024 { // over 768GB
|
||||||
partSize = 109951163 // ≈ 104.8576MB, split 1TB into 10,000 part
|
partSize = 109951163 // ≈ 104.8576MB, split 1TB into 10,000 part
|
||||||
} else if stream.GetSize() > 512*1024*1024*1024 { // over 512GB
|
} else if stream.GetSize() > 512*1024*1024*1024 { // over 512GB
|
||||||
|
@ -2,6 +2,7 @@ package aliyundrive_share
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"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) {
|
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)
|
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) {
|
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)
|
return d.limitLink(ctx, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,10 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
status, err = h.handleUnlock(brw, r)
|
status, err = h.handleUnlock(brw, r)
|
||||||
case "PROPFIND":
|
case "PROPFIND":
|
||||||
status, err = h.handlePropfind(brw, r)
|
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":
|
case "PROPPATCH":
|
||||||
status, err = h.handleProppatch(brw, r)
|
status, err = h.handleProppatch(brw, r)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user