Skip to content

Commit b8a7df2

Browse files
committed
chore: release v0.4.3
1 parent d1a4348 commit b8a7df2

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

common/version.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77

88
// Version is the service current released version.
99
// Semantic versioning: https://semver.org/
10-
var Version = "0.4.2"
10+
var Version = "0.4.3"
1111

1212
// DevVersion is the service current development version.
13-
var DevVersion = "0.4.2"
13+
var DevVersion = "0.4.3"
1414

1515
func GetCurrentVersion(mode string) string {
1616
if mode == "dev" {
@@ -27,6 +27,12 @@ func GetMinorVersion(version string) string {
2727
return versionList[0] + "." + versionList[1]
2828
}
2929

30+
func GetSchemaVersion(version string) string {
31+
minorVersion := GetMinorVersion(version)
32+
33+
return minorVersion + ".0"
34+
}
35+
3036
// convSemanticVersionToInt converts version string to int.
3137
func convSemanticVersionToInt(version string) int {
3238
versionList := strings.Split(version, ".")

server/acl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
7171
OpenID: &openID,
7272
}
7373
user, err := s.Store.FindUser(ctx, userFind)
74-
if err != nil {
74+
if err != nil && common.ErrorCode(err) != common.NotFound {
7575
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find user by open_id").SetInternal(err)
7676
}
7777
if user != nil {
@@ -90,7 +90,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
9090
ID: &userID,
9191
}
9292
user, err := s.Store.FindUser(ctx, userFind)
93-
if err != nil {
93+
if err != nil && common.ErrorCode(err) != common.NotFound {
9494
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find user by ID: %d", userID)).SetInternal(err)
9595
}
9696
if user != nil {

server/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
2424
Email: &signin.Email,
2525
}
2626
user, err := s.Store.FindUser(ctx, userFind)
27-
if err != nil {
27+
if err != nil && common.ErrorCode(err) != common.NotFound {
2828
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find user by email %s", signin.Email)).SetInternal(err)
2929
}
3030
if user == nil {
@@ -68,7 +68,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
6868
Role: &hostUserType,
6969
}
7070
hostUser, err := s.Store.FindUser(ctx, &hostUserFind)
71-
if err != nil {
71+
if err != nil && common.ErrorCode(err) != common.NotFound {
7272
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find host user").SetInternal(err)
7373
}
7474
if hostUser != nil {

server/system.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"net/http"
66

77
"github.com/usememos/memos/api"
8+
"github.com/usememos/memos/common"
89

910
"github.com/labstack/echo/v4"
1011
)
@@ -27,7 +28,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
2728
Role: &hostUserType,
2829
}
2930
hostUser, err := s.Store.FindUser(ctx, &hostUserFind)
30-
if err != nil {
31+
if err != nil && common.ErrorCode(err) != common.NotFound {
3132
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find host user").SetInternal(err)
3233
}
3334

store/db/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (db *DB) Open(ctx context.Context) (err error) {
8484
}
8585
}
8686

87-
if common.IsVersionGreaterThan(currentVersion, migrationHistory.Version) {
87+
if common.IsVersionGreaterThan(common.GetSchemaVersion(currentVersion), migrationHistory.Version) {
8888
minorVersionList := getMinorVersionList()
8989

9090
// backup the raw database file before migration

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "memos",
3-
"version": "0.4.2",
3+
"version": "0.4.3",
44
"scripts": {
55
"dev": "vite",
66
"build": "tsc && vite build",

0 commit comments

Comments
 (0)