Unverified Commit 5caa8cde authored by boojack's avatar boojack Committed by GitHub

chore: delete resource related file (#1456)

parent 9ede3da8
......@@ -19,7 +19,9 @@ import (
"github.com/pkg/errors"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
"github.com/usememos/memos/common/log"
"github.com/usememos/memos/plugin/storage/s3"
"go.uber.org/zap"
)
const (
......@@ -294,6 +296,13 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusUnauthorized, "Unauthorized")
}
if resource.InternalPath != "" {
err := os.Remove(resource.InternalPath)
if err != nil {
log.Warn(fmt.Sprintf("failed to delete local file with path %s", resource.InternalPath), zap.Error(err))
}
}
resourceDelete := &api.ResourceDelete{
ID: resourceID,
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment