aboutsummaryrefslogtreecommitdiff
path: root/src/client/Network.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Network.ts')
-rw-r--r--src/client/Network.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/client/Network.ts b/src/client/Network.ts
index 39bf69e32..89b31fdca 100644
--- a/src/client/Network.ts
+++ b/src/client/Network.ts
@@ -58,11 +58,16 @@ export namespace Networking {
])
);
}
+ formData.set('fileguids', fileguidpairs.map(pair => pair.guid).join(';'));
+ formData.set('filesize', fileguidpairs.reduce((sum, pair) => sum + pair.file.size, 0).toString());
// If the fileguidpair has a guid to use (From the overwriteDoc) use that guid. Otherwise, generate a new guid.
fileguidpairs.forEach(fileguidpair => formData.append(fileguidpair.guid ?? Utils.GenerateGuid(), fileguidpair.file));
} else {
// Handle the case where fileguidpairs is a single file.
- formData.append(fileguidpairs.guid ?? Utils.GenerateGuid(), fileguidpairs.file);
+ const guids = fileguidpairs.guid ?? Utils.GenerateGuid();
+ formData.set('fileguids', guids);
+ formData.set('filesize', fileguidpairs.file.size.toString());
+ formData.append(guids, fileguidpairs.file);
}
const parameters = {
method: 'POST',
@@ -74,10 +79,10 @@ export namespace Networking {
return response.json();
}
- export async function UploadYoutubeToServer<T extends Upload.FileInformation = Upload.FileInformation>(videoId: string): Promise<Upload.FileResponse<T>[]> {
+ export async function UploadYoutubeToServer<T extends Upload.FileInformation = Upload.FileInformation>(videoId: string, overwriteId?: string): Promise<Upload.FileResponse<T>[]> {
const parameters = {
method: 'POST',
- body: JSON.stringify({ videoId }),
+ body: JSON.stringify({ videoId, overwriteId }),
json: true,
};
const response = await fetch('/uploadYoutubeVideo', parameters);