create-100x-mobile 0.6.4 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -53,11 +53,53 @@ interface UploadPolicy {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const defaultAllowedContentTypes = [
|
|
56
|
+
// Images
|
|
56
57
|
"image/jpeg",
|
|
57
58
|
"image/png",
|
|
59
|
+
"image/gif",
|
|
58
60
|
"image/webp",
|
|
61
|
+
"image/svg+xml",
|
|
62
|
+
"image/bmp",
|
|
63
|
+
"image/tiff",
|
|
64
|
+
"image/heic",
|
|
65
|
+
"image/heif",
|
|
66
|
+
// Documents
|
|
59
67
|
"application/pdf",
|
|
60
68
|
"text/plain",
|
|
69
|
+
"text/csv",
|
|
70
|
+
"text/html",
|
|
71
|
+
"text/markdown",
|
|
72
|
+
// Microsoft Office
|
|
73
|
+
"application/msword",
|
|
74
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
75
|
+
"application/vnd.ms-excel",
|
|
76
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
77
|
+
"application/vnd.ms-powerpoint",
|
|
78
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
79
|
+
// Audio
|
|
80
|
+
"audio/mpeg",
|
|
81
|
+
"audio/wav",
|
|
82
|
+
"audio/ogg",
|
|
83
|
+
"audio/mp4",
|
|
84
|
+
"audio/webm",
|
|
85
|
+
"audio/aac",
|
|
86
|
+
// Video
|
|
87
|
+
"video/mp4",
|
|
88
|
+
"video/webm",
|
|
89
|
+
"video/quicktime",
|
|
90
|
+
"video/x-msvideo",
|
|
91
|
+
// Archives
|
|
92
|
+
"application/zip",
|
|
93
|
+
"application/gzip",
|
|
94
|
+
"application/x-tar",
|
|
95
|
+
"application/x-7z-compressed",
|
|
96
|
+
"application/x-rar-compressed",
|
|
97
|
+
// Code / data
|
|
98
|
+
"application/json",
|
|
99
|
+
"application/xml",
|
|
100
|
+
"application/javascript",
|
|
101
|
+
"application/typescript",
|
|
102
|
+
"application/octet-stream",
|
|
61
103
|
];
|
|
62
104
|
const defaultMaxUploadBytes = 25 * 1024 * 1024;
|
|
63
105
|
const defaultUserStorageLimitBytes = 500 * 1024 * 1024;
|
|
@@ -583,9 +625,17 @@ async function handleUpload(
|
|
|
583
625
|
const objectKey = ["uploads", user.id, uploadId].join("/");
|
|
584
626
|
let object: R2Object;
|
|
585
627
|
try {
|
|
628
|
+
const body = await request.arrayBuffer();
|
|
629
|
+
if (body.byteLength > policy.maxUploadBytes) {
|
|
630
|
+
throw createStorageApiError(
|
|
631
|
+
413,
|
|
632
|
+
"Upload exceeds the configured size limit.",
|
|
633
|
+
{ size: body.byteLength, maxUploadBytes: policy.maxUploadBytes },
|
|
634
|
+
);
|
|
635
|
+
}
|
|
586
636
|
object = await env.STORAGE.put(
|
|
587
637
|
objectKey,
|
|
588
|
-
|
|
638
|
+
body,
|
|
589
639
|
{
|
|
590
640
|
httpMetadata: {
|
|
591
641
|
contentType,
|