|
|
@ -2,8 +2,6 @@ package filesystem
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model "github.com/cloudreve/Cloudreve/v3/models"
|
|
|
|
model "github.com/cloudreve/Cloudreve/v3/models"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/fsctx"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/fsctx"
|
|
|
@ -11,6 +9,8 @@ import (
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/util"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/util"
|
|
|
|
"github.com/juju/ratelimit"
|
|
|
|
"github.com/juju/ratelimit"
|
|
|
|
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"net/url"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
/* ============
|
|
|
|
/* ============
|
|
|
@ -288,8 +288,11 @@ func (fs *FileSystem) signURL(ctx context.Context, file *model.File, ttl int64,
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", serializer.NewError(serializer.CodeNotSet, "无法获取外链", err)
|
|
|
|
return "", serializer.NewError(serializer.CodeNotSet, "无法获取外链", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 阿里云的 golang SDK 会把整个object KEY也编码 临时解决方案是清空`RawPath`让golang的`url.EscapedPath`修正这个问题
|
|
|
|
return source, nil
|
|
|
|
// https://github.com/cloudreve/Cloudreve/issues/677 https://github.com/aliyun/aliyun-oss-go-sdk/blob/6f7e8f88c64181cc2d86d8bd46090b68851e645a/oss/conn.go#L767
|
|
|
|
|
|
|
|
sourceUrl, _ := url.Parse(source)
|
|
|
|
|
|
|
|
sourceUrl.RawPath = ""
|
|
|
|
|
|
|
|
return sourceUrl.String(), nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ResetFileIfNotExist 重设当前目标文件为 path,如果当前目标为空
|
|
|
|
// ResetFileIfNotExist 重设当前目标文件为 path,如果当前目标为空
|
|
|
|