From d8a87379ca512a01ad0177697b830ca0ce8dc104 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 9 Apr 2018 05:14:47 +0900 Subject: [PATCH] Fix bug --- src/remote/activitypub/objects/image.ts | 9 ++++++++- src/remote/activitypub/type.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) 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 {