diff --git a/src/remote/activitypub/objects/image.ts b/src/remote/activitypub/objects/image.ts index 7f79fc5c0..d7bc5aff2 100644 --- a/src/remote/activitypub/objects/image.ts +++ b/src/remote/activitypub/objects/image.ts @@ -3,13 +3,20 @@ import * as debug from 'debug'; import uploadFromUrl from '../../../services/drive/upload-from-url'; import { IRemoteUser } from '../../../models/user'; import { IDriveFile } from '../../../models/drive-file'; +import Resolver from '../resolver'; const log = debug('misskey:activitypub'); /** * Imageを作成します。 */ -export async function createImage(actor: IRemoteUser, image): Promise { +export async function createImage(actor: IRemoteUser, value): Promise { + const image = await new Resolver().resolve(value); + + if (image.url == null) { + throw new Error('invalid image: url not privided'); + } + log(`Creating the Image: ${image.url}`); return await uploadFromUrl(image.url, actor); diff --git a/src/remote/activitypub/type.ts b/src/remote/activitypub/type.ts index 983eb621f..08e5493dd 100644 --- a/src/remote/activitypub/type.ts +++ b/src/remote/activitypub/type.ts @@ -14,6 +14,7 @@ export interface IObject { content: string; icon?: any; image?: any; + url?: string; } export interface IActivity extends IObject {