Fix #3149
This commit is contained in:
parent
f5ddfb29f2
commit
a8d05cba5a
|
@ -4,6 +4,7 @@ import uploadFromUrl from '../../../services/drive/upload-from-url';
|
||||||
import { IRemoteUser } from '../../../models/user';
|
import { IRemoteUser } from '../../../models/user';
|
||||||
import DriveFile, { IDriveFile } from '../../../models/drive-file';
|
import DriveFile, { IDriveFile } from '../../../models/drive-file';
|
||||||
import Resolver from '../resolver';
|
import Resolver from '../resolver';
|
||||||
|
import fetchMeta from '../../../misc/fetch-meta';
|
||||||
|
|
||||||
const log = debug('misskey:activitypub');
|
const log = debug('misskey:activitypub');
|
||||||
|
|
||||||
|
@ -24,7 +25,10 @@ export async function createImage(actor: IRemoteUser, value: any): Promise<IDriv
|
||||||
|
|
||||||
log(`Creating the Image: ${image.url}`);
|
log(`Creating the Image: ${image.url}`);
|
||||||
|
|
||||||
let file = await uploadFromUrl(image.url, actor, null, image.url, image.sensitive);
|
const instance = await fetchMeta();
|
||||||
|
const cache = instance.cacheRemoteFiles;
|
||||||
|
|
||||||
|
let file = await uploadFromUrl(image.url, actor, null, image.url, image.sensitive, false, !cache);
|
||||||
|
|
||||||
if (file.metadata.isRemote) {
|
if (file.metadata.isRemote) {
|
||||||
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
|
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
|
||||||
|
|
|
@ -10,7 +10,6 @@ import create from './add-file';
|
||||||
import config from '../../config';
|
import config from '../../config';
|
||||||
import { IUser } from '../../models/user';
|
import { IUser } from '../../models/user';
|
||||||
import * as mongodb from 'mongodb';
|
import * as mongodb from 'mongodb';
|
||||||
import fetchMeta from '../../misc/fetch-meta';
|
|
||||||
|
|
||||||
const log = debug('misskey:drive:upload-from-url');
|
const log = debug('misskey:drive:upload-from-url');
|
||||||
|
|
||||||
|
@ -20,7 +19,8 @@ export default async (
|
||||||
folderId: mongodb.ObjectID = null,
|
folderId: mongodb.ObjectID = null,
|
||||||
uri: string = null,
|
uri: string = null,
|
||||||
sensitive = false,
|
sensitive = false,
|
||||||
force = false
|
force = false,
|
||||||
|
link = false
|
||||||
): Promise<IDriveFile> => {
|
): Promise<IDriveFile> => {
|
||||||
log(`REQUESTED: ${url}`);
|
log(`REQUESTED: ${url}`);
|
||||||
|
|
||||||
|
@ -77,13 +77,11 @@ export default async (
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const instance = await fetchMeta();
|
|
||||||
|
|
||||||
let driveFile: IDriveFile;
|
let driveFile: IDriveFile;
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
driveFile = await create(user, path, name, null, folderId, force, !instance.cacheRemoteFiles, url, uri, sensitive);
|
driveFile = await create(user, path, name, null, folderId, force, link, url, uri, sensitive);
|
||||||
log(`got: ${driveFile._id}`);
|
log(`got: ${driveFile._id}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
||||||
|
|
Loading…
Reference in New Issue