mirror of https://github.com/cloudreve/Cloudreve
fix(dbfs): set current version is not executed from existing transaction
parent
ca47f79ecb
commit
67d3b25c87
|
@ -8,6 +8,10 @@ import (
|
|||
_ "embed"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cloudreve/Cloudreve/v4/application/constants"
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/logging"
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/util"
|
||||
"github.com/gin-contrib/static"
|
||||
"io"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
|
@ -16,11 +20,6 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cloudreve/Cloudreve/v4/application/constants"
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/logging"
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/util"
|
||||
"github.com/gin-contrib/static"
|
||||
)
|
||||
|
||||
const StaticFolder = "statics"
|
||||
|
|
|
@ -651,7 +651,8 @@ func (f *DBFS) setCurrentVersion(ctx context.Context, target *File, versionId in
|
|||
return serializer.NewError(serializer.CodeDBError, "Failed to start transaction", err)
|
||||
}
|
||||
|
||||
if err := f.fileClient.SetPrimaryEntity(ctx, target.Model, targetVersion.ID()); err != nil {
|
||||
if err := fc.SetPrimaryEntity(ctx, target.Model, targetVersion.ID()); err != nil {
|
||||
_ = inventory.Rollback(tx)
|
||||
return serializer.NewError(serializer.CodeDBError, "Failed to set primary entity", err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue