mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-09 16:54:21 +01:00
This commit is contained in:
parent
4170f50dc6
commit
102d9364fd
25 changed files with 118 additions and 398 deletions
|
|
@ -17,13 +17,14 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/html"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/siyuan/kernel/model"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
|
|
@ -73,7 +74,7 @@ func checkBlockExist(c *gin.Context) {
|
|||
|
||||
id := arg["id"].(string)
|
||||
b, err := model.GetBlock(id)
|
||||
if filesys.ErrUnableLockFile == err {
|
||||
if errors.Is(err, filelock.ErrUnableLockFile) {
|
||||
ret.Code = 2
|
||||
ret.Data = id
|
||||
return
|
||||
|
|
@ -221,7 +222,7 @@ func getBlockInfo(c *gin.Context) {
|
|||
|
||||
id := arg["id"].(string)
|
||||
block, err := model.GetBlock(id)
|
||||
if filesys.ErrUnableLockFile == err {
|
||||
if errors.Is(err, filelock.ErrUnableLockFile) {
|
||||
ret.Code = 2
|
||||
ret.Data = id
|
||||
return
|
||||
|
|
@ -247,7 +248,7 @@ func getBlockInfo(c *gin.Context) {
|
|||
}
|
||||
|
||||
root, err := model.GetBlock(block.RootID)
|
||||
if filesys.ErrUnableLockFile == err {
|
||||
if errors.Is(err, filelock.ErrUnableLockFile) {
|
||||
ret.Code = 2
|
||||
ret.Data = id
|
||||
return
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import (
|
|||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/siyuan/kernel/model"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
|
@ -92,7 +92,7 @@ func putFile(c *gin.Context) {
|
|||
if err = os.MkdirAll(dir, 0755); nil != err {
|
||||
util.LogErrorf("put a file [%s] make dir [%s] failed: %s", filePath, dir, err)
|
||||
} else {
|
||||
if filesys.IsLocked(filePath) {
|
||||
if filelock.IsLocked(filePath) {
|
||||
msg := fmt.Sprintf("file [%s] is locked", filePath)
|
||||
util.LogErrorf(msg)
|
||||
err = errors.New(msg)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path"
|
||||
|
|
@ -26,7 +27,7 @@ import (
|
|||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/siyuan/kernel/model"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
|
@ -592,7 +593,7 @@ func getDoc(c *gin.Context) {
|
|||
}
|
||||
|
||||
blockCount, content, parentID, parent2ID, rootID, typ, eof, boxID, docPath, err := model.GetDoc(id, index, keyword, mode, size)
|
||||
if filesys.ErrUnableLockFile == err {
|
||||
if errors.Is(err, filelock.ErrUnableLockFile) {
|
||||
ret.Code = 2
|
||||
ret.Data = id
|
||||
return
|
||||
|
|
|
|||
|
|
@ -17,13 +17,14 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/siyuan/kernel/model"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
|
|
@ -64,7 +65,7 @@ func performTransactions(c *gin.Context) {
|
|||
err = model.PerformTransactions(&transactions)
|
||||
}
|
||||
|
||||
if filesys.ErrUnableLockFile == err {
|
||||
if errors.Is(err, filelock.ErrUnableLockFile) {
|
||||
ret.Code = 1
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue