fix: capture all formData entries in share targets; bump sw cache to v4
This commit is contained in:
1 parent
3ed7fb8036
commit
723d40e546
3 files changed
+13
-13
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Everclone PWA Service Worker (v2.0.0)
|
||||
const CACHE_NAME = 'everclone-cache-v3';
|
||||
// Everclone PWA Service Worker (v2.1.0)
|
||||
const CACHE_NAME = 'everclone-cache-v4';
|
||||
const STATIC_ASSETS = [
|
||||
'/',
|
||||
'/manifest.json',
|
||||
|
||||
@@ -109,10 +109,14 @@ export async function POST(req: NextRequest) {
|
||||
.map((t) => t.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
const files = formData.getAll('files') as File[];
|
||||
const single = formData.get('file') as File | null;
|
||||
if (single && files.length === 0) files.push(single);
|
||||
uploadedFiles.push(...files);
|
||||
for (const [key, value] of formData.entries()) {
|
||||
if (value && typeof value === 'object' && 'arrayBuffer' in value) {
|
||||
const file = value as File;
|
||||
if (file.size > 0) {
|
||||
uploadedFiles.push(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if Android shared a URL inside the `text`, `content`, or `title`
|
||||
|
||||
@@ -169,13 +169,9 @@ export async function POST(req: NextRequest) {
|
||||
).trim();
|
||||
url = ((formData.get('url') as string) || '').trim();
|
||||
|
||||
const rawFiles = [
|
||||
...formData.getAll('files'),
|
||||
...formData.getAll('file'),
|
||||
];
|
||||
for (const item of rawFiles) {
|
||||
if (item && typeof item === 'object' && 'arrayBuffer' in item) {
|
||||
const file = item as File;
|
||||
for (const [key, value] of formData.entries()) {
|
||||
if (value && typeof value === 'object' && 'arrayBuffer' in value) {
|
||||
const file = value as File;
|
||||
if (file.size > 0) {
|
||||
uploadedFiles.push(file);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user