summaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2023-04-15 21:07:16 +0200
committerBrian Picciano <mediocregopher@gmail.com>2023-04-15 21:07:16 +0200
commit7872296b838f4d1b26c6a0a01d79d27fe5ab44cc (patch)
tree9487f5abb93d88ab3b52700d2b3002b7dda373d6 /src/http
parent68f3215df6e2e4f345076dd5b20b9bf5867353cf (diff)
Move asset store into its own package
Diffstat (limited to 'src/http')
-rw-r--r--src/http/assets.go8
-rw-r--r--src/http/http.go3
2 files changed, 6 insertions, 5 deletions
diff --git a/src/http/assets.go b/src/http/assets.go
index 5b26a2e..1f5f0d6 100644
--- a/src/http/assets.go
+++ b/src/http/assets.go
@@ -16,7 +16,7 @@ import (
"time"
"github.com/mediocregopher/blog.mediocregopher.com/srv/http/apiutil"
- "github.com/mediocregopher/blog.mediocregopher.com/srv/post"
+ "github.com/mediocregopher/blog.mediocregopher.com/srv/post/asset"
"github.com/omeid/go-tarfs"
"golang.org/x/image/draw"
)
@@ -170,7 +170,7 @@ func (a *api) handleGetPostAssetArchive(
err := a.params.PostAssetStore.Get(info.id, buf)
- if errors.Is(err, post.ErrAssetNotFound) {
+ if errors.Is(err, asset.ErrNotFound) {
http.Error(rw, "asset not found", 404)
return
} else if err != nil {
@@ -244,7 +244,7 @@ func (a *api) getPostAssetHandler() http.Handler {
err := a.params.PostAssetStore.Get(id, buf)
- if errors.Is(err, post.ErrAssetNotFound) {
+ if errors.Is(err, asset.ErrNotFound) {
http.Error(rw, "Asset not found", 404)
return
} else if err != nil {
@@ -297,7 +297,7 @@ func (a *api) deletePostAssetHandler() http.Handler {
err := a.params.PostAssetStore.Delete(id)
- if errors.Is(err, post.ErrAssetNotFound) {
+ if errors.Is(err, asset.ErrNotFound) {
http.Error(rw, "Asset not found", 404)
return
} else if err != nil {
diff --git a/src/http/http.go b/src/http/http.go
index da404dc..dc2569a 100644
--- a/src/http/http.go
+++ b/src/http/http.go
@@ -20,6 +20,7 @@ import (
"github.com/mediocregopher/blog.mediocregopher.com/srv/http/apiutil"
"github.com/mediocregopher/blog.mediocregopher.com/srv/mailinglist"
"github.com/mediocregopher/blog.mediocregopher.com/srv/post"
+ "github.com/mediocregopher/blog.mediocregopher.com/srv/post/asset"
"github.com/mediocregopher/blog.mediocregopher.com/srv/pow"
"github.com/mediocregopher/mediocre-go-lib/v2/mctx"
"github.com/mediocregopher/mediocre-go-lib/v2/mlog"
@@ -36,7 +37,7 @@ type Params struct {
Cache cache.Cache
PostStore post.Store
- PostAssetStore post.AssetStore
+ PostAssetStore asset.Store
PostDraftStore post.DraftStore
MailingList mailinglist.MailingList