Fix testing reported issues (#1177)

This commit is contained in:
Abhinav Kumar 2023-06-10 13:12:13 +05:30 committed by GitHub
commit d8b0f76366
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

View file

@ -528,5 +528,5 @@
"SORT_BY": "Sort by",
"NEWEST_FIRST": "Newest first",
"OLDEST_FIRST": "Oldest first",
"CONVERSION_FAILED_NOTIFICATION_MESSAGE": "This file could not be previewed, click here to download the original"
"CONVERSION_FAILED_NOTIFICATION_MESSAGE": "This file could not be previewed. Click here to download the original."
}

View file

@ -19,10 +19,10 @@ export const ConversionFailedNotification = ({ onClick }: Iprops) => {
onClose={handleClose}
attributes={{
variant: 'secondary',
message: t('CONVERSION_FAILED_NOTIFICATION_MESSAGE'),
subtext: t('CONVERSION_FAILED_NOTIFICATION_MESSAGE'),
onClick: onClick,
}}
horizontal="left"
horizontal="right"
vertical="bottom"
sx={{ zIndex: 4000 }}
/>

View file

@ -19,6 +19,7 @@ const EXIF_TIME_TAGS = [
'CreateDate',
'ModifyDate',
'DateCreated',
'MetadataDate',
];
export async function updateCreationTimeWithExif(

View file

@ -4,7 +4,7 @@ import { ReactNode } from 'react';
export interface NotificationAttributes {
startIcon?: ReactNode;
variant: ButtonProps['color'];
message: JSX.Element | string;
message?: JSX.Element | string;
subtext?: JSX.Element | string;
onClick: () => void;
endIcon?: ReactNode;

View file

@ -30,7 +30,7 @@ import * as ffmpegService from 'services/ffmpeg/ffmpegService';
import { VISIBILITY_STATE } from 'types/magicMetadata';
import { IsArchived, updateMagicMetadata } from 'utils/magicMetadata';
import { addLogLine } from 'utils/logging';
import { addLocalLog, addLogLine } from 'utils/logging';
import { CustomError } from 'utils/error';
import { convertBytesToHumanReadable } from './size';
import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker';
@ -41,6 +41,7 @@ import {
import isElectron from 'is-electron';
import imageProcessor from 'services/electron/imageProcessor';
import { isPlaybackPossible } from 'utils/photoFrame';
import { FileTypeInfo } from 'types/upload';
const WAIT_TIME_IMAGE_CONVERSION = 30 * 1000;
@ -358,10 +359,12 @@ export async function getPlayableVideo(
}
export async function getRenderableImage(fileName: string, imageBlob: Blob) {
let fileTypeInfo: FileTypeInfo;
try {
throw Error('not implemented');
const tempFile = new File([imageBlob], fileName);
const { exactType } = await getFileType(tempFile);
fileTypeInfo = await getFileType(tempFile);
addLocalLog(() => `file type info: ${JSON.stringify(fileTypeInfo)}`);
const { exactType } = fileTypeInfo;
let convertedImageBlob: Blob;
if (isRawFile(exactType)) {
try {
@ -405,7 +408,7 @@ export async function getRenderableImage(fileName: string, imageBlob: Blob) {
return imageBlob;
}
} catch (e) {
logError(e, 'get Renderable Image failed');
logError(e, 'get Renderable Image failed', { fileTypeInfo });
return null;
}
}