feat(media): unify uploads onto modules/album, add batched srcset enrichment and Media Library picker
This commit is contained in:
@@ -76,15 +76,24 @@ func TestJournal006MediaUpload(t *testing.T) {
|
||||
}
|
||||
var body struct {
|
||||
Data struct {
|
||||
URL string `json:"url"`
|
||||
Path string `json:"path"`
|
||||
URL string `json:"url"`
|
||||
Path string `json:"path"`
|
||||
ID uint `json:"id"`
|
||||
ShortID string `json:"short_id"`
|
||||
Width *int `json:"width"`
|
||||
Height *int `json:"height"`
|
||||
Variants []any `json:"variants"`
|
||||
Srcset string `json:"srcset"`
|
||||
} `json:"data"`
|
||||
}
|
||||
if err := json.Unmarshal(created.Body.Bytes(), &body); err != nil {
|
||||
t.Fatalf("upload json: %s err=%v", created.Body.String(), err)
|
||||
}
|
||||
if !strings.HasPrefix(body.Data.Path, "/journal/") {
|
||||
t.Fatalf("path = %q, want prefix /journal/", body.Data.Path)
|
||||
if !strings.HasPrefix(body.Data.Path, "/media/") {
|
||||
t.Fatalf("path = %q, want prefix /media/", body.Data.Path)
|
||||
}
|
||||
if body.Data.ID == 0 || body.Data.ShortID == "" || body.Data.Width == nil || body.Data.Height == nil {
|
||||
t.Fatalf("expected additive album metadata (id, short_id, width, height), got %+v", body.Data)
|
||||
}
|
||||
|
||||
trav := env.callMultipart(t, http.MethodPost, "/_journal/api/v1/media/upload", okTok, map[string]string{"folder": "../etc"}, "file", "cover.png", png1x1)
|
||||
|
||||
Reference in New Issue
Block a user