fix: file createdAt can be string

This commit is contained in:
Namekuji 2023-09-05 19:44:37 -04:00
parent 970bf99c09
commit 1606163ad7
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532
2 changed files with 5 additions and 2 deletions

View file

@ -140,7 +140,7 @@ export function parseScyllaNotification(row: types.Row): ScyllaNotification {
export interface ScyllaDriveFile {
id: string;
type: string;
createdAt: Date;
createdAt: Date | string;
name: string;
comment: string | null;
blurhash: string | null;

View file

@ -327,7 +327,10 @@ export const NoteRepository = db.getRepository(Note).extend({
? (note as ScyllaNote).files.map((file) => ({
...file,
thumbnailUrl: getScyllaDrivePublicUrl(file, true),
createdAt: file.createdAt.toISOString(),
createdAt: (typeof file.createdAt === "string"
? new Date(file.createdAt)
: file.createdAt
).toISOString(),
properties: {
width: file.width ?? undefined,
height: file.height ?? undefined,