From ed56dbe3fd3aef67928e31f2fc18d548c5744f36 Mon Sep 17 00:00:00 2001 From: Samuel Hassine Date: Thu, 15 Apr 2021 17:33:09 +0200 Subject: [PATCH] [api] Fix manual import --- opencti-platform/opencti-graphql/src/domain/file.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opencti-platform/opencti-graphql/src/domain/file.js b/opencti-platform/opencti-graphql/src/domain/file.js index 956457be6301..f410ea5abbd0 100644 --- a/opencti-platform/opencti-graphql/src/domain/file.js +++ b/opencti-platform/opencti-graphql/src/domain/file.js @@ -8,14 +8,14 @@ import { internalLoadById } from '../database/middleware'; import { isStixDomainObjectContainer } from '../schema/stixDomainObject'; import { UnsupportedError } from '../config/errors'; -export const uploadJobImport = async (user, fileId, fileMime, entityId) => { +export const uploadJobImport = async (user, fileId, fileMime, entityId, manual = false) => { let isImportInContainer = false; if (entityId) { const entity = await internalLoadById(user, entityId); isImportInContainer = isStixDomainObjectContainer(entity.entity_type); if (!isImportInContainer) throw UnsupportedError('Cant importing on none container entity'); } - const connectors = await connectorsForImport(user, fileMime, true, true); + const connectors = await connectorsForImport(user, fileMime, true, !manual); if (connectors.length > 0) { // Create job and send ask to broker const createConnectorWork = async (connector) => { @@ -51,7 +51,7 @@ export const uploadJobImport = async (user, fileId, fileMime, entityId) => { export const askJobImport = async (user, filename) => { logApp.debug(`[JOBS] ask import for file ${filename} by ${user.user_email}`); const file = await loadFile(user, filename); - await uploadJobImport(user, file.id, file.metaData.mimetype, file.metaData.entity_id); + await uploadJobImport(user, file.id, file.metaData.mimetype, file.metaData.entity_id, true); return file; };