Address Discord comments
This commit is contained in:
@@ -55,12 +55,6 @@ export const fileUploadHandler = async (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOT USABLE, due to type being empty on .srw and .raf files and
|
|
||||||
// since it's readonly field.
|
|
||||||
// const acceptedFile = files.filter(
|
|
||||||
// (e) => e.type.split('/')[0] === 'video' || e.type.split('/')[0] === 'image'
|
|
||||||
// );
|
|
||||||
|
|
||||||
for (const asset of files) {
|
for (const asset of files) {
|
||||||
await fileUploader(asset, albumId, sharedKey, onDone);
|
await fileUploader(asset, albumId, sharedKey, onDone);
|
||||||
}
|
}
|
||||||
@@ -112,7 +106,7 @@ async function fileUploader(
|
|||||||
formData.append('deviceId', 'WEB');
|
formData.append('deviceId', 'WEB');
|
||||||
|
|
||||||
// Get asset type
|
// Get asset type
|
||||||
formData.append('assetType', isRawImageType(fileExtension) || assetType);
|
formData.append('assetType', assetType);
|
||||||
|
|
||||||
// Get Asset Created Date
|
// Get Asset Created Date
|
||||||
formData.append('createdAt', createdAt);
|
formData.append('createdAt', createdAt);
|
||||||
@@ -211,14 +205,6 @@ async function fileUploader(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRawImageType(fileExtension: string): string | null {
|
|
||||||
const RAW_TYPES = ['raf', 'srw'];
|
|
||||||
if (RAW_TYPES.includes(fileExtension.toLowerCase())) {
|
|
||||||
return 'IMAGE';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleUploadError(asset: File, respBody = '{}', extraMessage?: string) {
|
function handleUploadError(asset: File, respBody = '{}', extraMessage?: string) {
|
||||||
try {
|
try {
|
||||||
const res = JSON.parse(respBody);
|
const res = JSON.parse(respBody);
|
||||||
|
|||||||
Reference in New Issue
Block a user