Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: release `v0.4.3`

Stevenb8a7df21f2a0
diff --git a/common/version.go b/common/version.go
index 781a21aaf..8c92f4063 100644
--- a/common/version.go
+++ b/common/version.go
@@ -7,10 +7,10 @@ import (
// Version is the service current released version.
// Semantic versioning: https://semver.org/
-var Version = "0.4.2"
+var Version = "0.4.3"
// DevVersion is the service current development version.
-var DevVersion = "0.4.2"
+var DevVersion = "0.4.3"
func GetCurrentVersion(mode string) string {
if mode == "dev" {
@@ -27,6 +27,12 @@ func GetMinorVersion(version string) string {
return versionList[0] + "." + versionList[1]
}
+func GetSchemaVersion(version string) string {
+ minorVersion := GetMinorVersion(version)
+
+ return minorVersion + ".0"
+}
+
// convSemanticVersionToInt converts version string to int.
func convSemanticVersionToInt(version string) int {
versionList := strings.Split(version, ".")
diff --git a/server/acl.go b/server/acl.go
index ca5a45711..371cb1120 100644
--- a/server/acl.go
+++ b/server/acl.go
@@ -71,7 +71,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
OpenID: &openID,
}
user, err := s.Store.FindUser(ctx, userFind)
- if err != nil {
+ if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find user by open_id").SetInternal(err)
}
if user != nil {
@@ -90,7 +90,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
ID: &userID,
}
user, err := s.Store.FindUser(ctx, userFind)
- if err != nil {
+ if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find user by ID: %d", userID)).SetInternal(err)
}
if user != nil {
diff --git a/server/auth.go b/server/auth.go
index 7517551e6..ac2b378e0 100644
--- a/server/auth.go
+++ b/server/auth.go
@@ -24,7 +24,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
Email: &signin.Email,
}
user, err := s.Store.FindUser(ctx, userFind)
- if err != nil {
+ if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find user by email %s", signin.Email)).SetInternal(err)
}
if user == nil {
@@ -68,7 +68,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
Role: &hostUserType,
}
hostUser, err := s.Store.FindUser(ctx, &hostUserFind)
- if err != nil {
+ if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find host user").SetInternal(err)
}
if hostUser != nil {
diff --git a/server/system.go b/server/system.go
index e72b041f3..a468dc79b 100644
--- a/server/system.go
+++ b/server/system.go
@@ -5,6 +5,7 @@ import (
"net/http"
"github.com/usememos/memos/api"
+ "github.com/usememos/memos/common"
"github.com/labstack/echo/v4"
)
@@ -27,7 +28,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
Role: &hostUserType,
}
hostUser, err := s.Store.FindUser(ctx, &hostUserFind)
- if err != nil {
+ if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find host user").SetInternal(err)
}
diff --git a/store/db/db.go b/store/db/db.go
index 14d1dff31..22c29e72f 100644
--- a/store/db/db.go
+++ b/store/db/db.go
@@ -84,7 +84,7 @@ func (db *DB) Open(ctx context.Context) (err error) {
}
}
- if common.IsVersionGreaterThan(currentVersion, migrationHistory.Version) {
+ if common.IsVersionGreaterThan(common.GetSchemaVersion(currentVersion), migrationHistory.Version) {
minorVersionList := getMinorVersionList()
// backup the raw database file before migration
diff --git a/web/package.json b/web/package.json
index 9e78a2d4d..3e075016a 100644
--- a/web/package.json
+++ b/web/package.json
@@ -1,6 +1,6 @@
{
"name": "memos",
- "version": "0.4.2",
+ "version": "0.4.3",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",