mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
This commit is contained in:
parent
d0e0e1a7bc
commit
6a0d69cfef
1 changed files with 11 additions and 3 deletions
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/lute/ast"
|
"github.com/88250/lute/ast"
|
||||||
"github.com/88250/lute/parse"
|
"github.com/88250/lute/parse"
|
||||||
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/gabriel-vasile/mimetype"
|
"github.com/gabriel-vasile/mimetype"
|
||||||
"github.com/siyuan-note/filelock"
|
"github.com/siyuan-note/filelock"
|
||||||
"github.com/siyuan-note/httpclient"
|
"github.com/siyuan-note/httpclient"
|
||||||
|
|
@ -327,13 +328,20 @@ func uploadCloud(sqlAssets []*sql.Asset) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
limitSize := uint64(3 * 1024 * 1024) // 3MB
|
||||||
|
if IsSubscriber() {
|
||||||
|
limitSize = 10 * 1024 * 1024 // 10MB
|
||||||
|
}
|
||||||
var completedUploadAssets []string
|
var completedUploadAssets []string
|
||||||
for _, absAsset := range uploadAbsAssets {
|
for _, absAsset := range uploadAbsAssets {
|
||||||
if fi, statErr := os.Stat(absAsset); nil != statErr {
|
fi, statErr := os.Stat(absAsset)
|
||||||
|
if nil != statErr {
|
||||||
logging.LogErrorf("stat file [%s] failed: %s", absAsset, statErr)
|
logging.LogErrorf("stat file [%s] failed: %s", absAsset, statErr)
|
||||||
return statErr
|
return statErr
|
||||||
} else if 10*1024*1024 <= fi.Size() {
|
}
|
||||||
logging.LogWarnf("file [%s] larger than 10MB, ignore uploading it", absAsset)
|
|
||||||
|
if limitSize < uint64(fi.Size()) {
|
||||||
|
logging.LogWarnf("file [%s] larger than limit size [%s], ignore uploading it", humanize.IBytes(limitSize), absAsset)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue