fix(lagoon/attach): store non-inline uploads with Content-Disposition attachment (quick-261028-rqe)
- attach.IsInlineContentType: the shared inline raster list (JPEG, PNG, GIF, WebP, AVIF), parameters and case ignored, false for empty or unparsable values - writeBlob stores Content-Disposition: attachment for every other type, so a public bucket or CDN makes the browser download HTML, SVG, PDF or plain text; content_type and thumbnails are unchanged - driver tests on memblob and fileblob, Postgres-backed Store assertion, lagoon README and the storage and attachments pages
This commit is contained in:
@@ -128,6 +128,14 @@ func TestFileThumbResizesOnce(t *testing.T) {
|
||||
if url1 != want || url2 != want {
|
||||
t.Fatalf("urls = %q %q, want %q", url1, url2, want)
|
||||
}
|
||||
// Thumbnails stay inline: an image type and no disposition.
|
||||
attrs, err := bucket.Attributes(ctx, strings.TrimPrefix(url1, "/storage/uploads/"))
|
||||
if err != nil {
|
||||
t.Fatalf("thumbnail Attributes: %v", err)
|
||||
}
|
||||
if attrs.ContentType != "image/jpeg" || attrs.ContentDisposition != "" {
|
||||
t.Fatalf("thumbnail attrs = %q %q, want image/jpeg and no disposition", attrs.ContentType, attrs.ContentDisposition)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFileThumbEncodeFailureDoesNotCache(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user