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)
|
// Everclone PWA Service Worker (v2.1.0)
|
||||||
const CACHE_NAME = 'everclone-cache-v3';
|
const CACHE_NAME = 'everclone-cache-v4';
|
||||||
const STATIC_ASSETS = [
|
const STATIC_ASSETS = [
|
||||||
'/',
|
'/',
|
||||||
'/manifest.json',
|
'/manifest.json',
|
||||||
|
|||||||
@@ -109,10 +109,14 @@ export async function POST(req: NextRequest) {
|
|||||||
.map((t) => t.trim())
|
.map((t) => t.trim())
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}
|
}
|
||||||
const files = formData.getAll('files') as File[];
|
for (const [key, value] of formData.entries()) {
|
||||||
const single = formData.get('file') as File | null;
|
if (value && typeof value === 'object' && 'arrayBuffer' in value) {
|
||||||
if (single && files.length === 0) files.push(single);
|
const file = value as File;
|
||||||
uploadedFiles.push(...files);
|
if (file.size > 0) {
|
||||||
|
uploadedFiles.push(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if Android shared a URL inside the `text`, `content`, or `title`
|
// Check if Android shared a URL inside the `text`, `content`, or `title`
|
||||||
|
|||||||
@@ -169,13 +169,9 @@ export async function POST(req: NextRequest) {
|
|||||||
).trim();
|
).trim();
|
||||||
url = ((formData.get('url') as string) || '').trim();
|
url = ((formData.get('url') as string) || '').trim();
|
||||||
|
|
||||||
const rawFiles = [
|
for (const [key, value] of formData.entries()) {
|
||||||
...formData.getAll('files'),
|
if (value && typeof value === 'object' && 'arrayBuffer' in value) {
|
||||||
...formData.getAll('file'),
|
const file = value as File;
|
||||||
];
|
|
||||||
for (const item of rawFiles) {
|
|
||||||
if (item && typeof item === 'object' && 'arrayBuffer' in item) {
|
|
||||||
const file = item as File;
|
|
||||||
if (file.size > 0) {
|
if (file.size > 0) {
|
||||||
uploadedFiles.push(file);
|
uploadedFiles.push(file);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user