diff options
Diffstat (limited to 'server/lib/avatar.ts')
-rw-r--r-- | server/lib/avatar.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts index 021426a1a..09b4e38ca 100644 --- a/server/lib/avatar.ts +++ b/server/lib/avatar.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import 'multer' | 1 | import 'multer' |
2 | import { sendUpdateActor } from './activitypub/send' | 2 | import { sendUpdateActor } from './activitypub/send' |
3 | import { AVATARS_SIZE, CONFIG, sequelizeTypescript } from '../initializers' | 3 | import { AVATARS_SIZE } from '../initializers/constants' |
4 | import { updateActorAvatarInstance } from './activitypub' | 4 | import { updateActorAvatarInstance } from './activitypub' |
5 | import { processImage } from '../helpers/image-utils' | 5 | import { processImage } from '../helpers/image-utils' |
6 | import { AccountModel } from '../models/account/account' | 6 | import { AccountModel } from '../models/account/account' |
@@ -8,12 +8,14 @@ import { VideoChannelModel } from '../models/video/video-channel' | |||
8 | import { extname, join } from 'path' | 8 | import { extname, join } from 'path' |
9 | import { retryTransactionWrapper } from '../helpers/database-utils' | 9 | import { retryTransactionWrapper } from '../helpers/database-utils' |
10 | import * as uuidv4 from 'uuid/v4' | 10 | import * as uuidv4 from 'uuid/v4' |
11 | import { CONFIG } from '../initializers/config' | ||
12 | import { sequelizeTypescript } from '../initializers/database' | ||
11 | 13 | ||
12 | async function updateActorAvatarFile (avatarPhysicalFile: Express.Multer.File, accountOrChannel: AccountModel | VideoChannelModel) { | 14 | async function updateActorAvatarFile (avatarPhysicalFile: Express.Multer.File, accountOrChannel: AccountModel | VideoChannelModel) { |
13 | const extension = extname(avatarPhysicalFile.filename) | 15 | const extension = extname(avatarPhysicalFile.filename) |
14 | const avatarName = uuidv4() + extension | 16 | const avatarName = uuidv4() + extension |
15 | const destination = join(CONFIG.STORAGE.AVATARS_DIR, avatarName) | 17 | const destination = join(CONFIG.STORAGE.AVATARS_DIR, avatarName) |
16 | await processImage(avatarPhysicalFile, destination, AVATARS_SIZE) | 18 | await processImage(avatarPhysicalFile.path, destination, AVATARS_SIZE) |
17 | 19 | ||
18 | return retryTransactionWrapper(() => { | 20 | return retryTransactionWrapper(() => { |
19 | return sequelizeTypescript.transaction(async t => { | 21 | return sequelizeTypescript.transaction(async t => { |