mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🎨 Asset link element prompt shows more information https://github.com/siyuan-note/siyuan/issues/10714
This commit is contained in:
parent
1d176d5a09
commit
1362def271
1 changed files with 15 additions and 11 deletions
|
|
@ -42,27 +42,31 @@ func statAsset(c *gin.Context) {
|
|||
}
|
||||
|
||||
path := arg["path"].(string)
|
||||
p, err := model.GetAssetAbsPath(path)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 3000}
|
||||
var p string
|
||||
if strings.HasPrefix(path, "assets/") {
|
||||
var err error
|
||||
p, err = model.GetAssetAbsPath(path)
|
||||
if nil != err {
|
||||
ret.Code = 1
|
||||
return
|
||||
}
|
||||
|
||||
} else if strings.HasPrefix(path, "file://") {
|
||||
p = strings.TrimPrefix(path, "file://")
|
||||
} else {
|
||||
ret.Code = 1
|
||||
return
|
||||
}
|
||||
|
||||
info, err := os.Stat(p)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 3000}
|
||||
ret.Code = 1
|
||||
return
|
||||
}
|
||||
|
||||
t, err := times.Stat(p)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 3000}
|
||||
ret.Code = 1
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue