chore: delete resource related file (#1456)
This commit is contained in:
parent
9ede3da882
commit
5caa8cdec5
1 changed files with 9 additions and 0 deletions
|
|
@ -19,7 +19,9 @@ import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/usememos/memos/api"
|
"github.com/usememos/memos/api"
|
||||||
"github.com/usememos/memos/common"
|
"github.com/usememos/memos/common"
|
||||||
|
"github.com/usememos/memos/common/log"
|
||||||
"github.com/usememos/memos/plugin/storage/s3"
|
"github.com/usememos/memos/plugin/storage/s3"
|
||||||
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -294,6 +296,13 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
|
||||||
return echo.NewHTTPError(http.StatusUnauthorized, "Unauthorized")
|
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{
|
resourceDelete := &api.ResourceDelete{
|
||||||
ID: resourceID,
|
ID: resourceID,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue