fix: return external link directly (#1465)

* fix: return external link directly

* chore: update
This commit is contained in:
boojack
2023-04-04 08:31:11 +08:00
committed by GitHub
parent 5361f76b11
commit 6ff7cfddda
4 changed files with 16 additions and 15 deletions
-4
View File
@@ -334,10 +334,6 @@ func (s *Server) registerResourcePublicRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find resource by ID: %v", resourceID)).SetInternal(err)
}
if resource.ExternalLink != "" {
return c.Redirect(http.StatusSeeOther, resource.ExternalLink)
}
blob := resource.Blob
if resource.InternalPath != "" {
src, err := os.Open(resource.InternalPath)
+4 -1
View File
@@ -9,6 +9,8 @@ import (
"github.com/google/uuid"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
"github.com/usememos/memos/common/log"
"go.uber.org/zap"
"github.com/labstack/echo/v4"
)
@@ -67,7 +69,8 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
var baseValue any
err := json.Unmarshal([]byte(systemSetting.Value), &baseValue)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to unmarshal system setting value").SetInternal(err)
log.Warn("Failed to unmarshal system setting value", zap.String("setting name", systemSetting.Name.String()))
continue
}
if systemSetting.Name == api.SystemSettingAllowSignUpName {