Commit 1d10b0f5 authored by Nikos Marinos's avatar Nikos Marinos
parent 385d193d
Pipeline #12959 passed with stages
in 5 minutes and 37 seconds
......@@ -156,13 +156,17 @@ function getUser(rootPath, filename) {
}
async function runProcess(packagePath) {
let packageName
let submitter
let tmpPath
let manuscriptDb
try {
logger.info(`Starting Bulk Import Process for ${packagePath}`)
// global.globalPath = packagePath
const packageName = path.basename(packagePath)
const submitter = await getUser(rootPath, packagePath)
packageName = path.basename(packagePath)
submitter = await getUser(rootPath, packagePath)
// await authenticate(pubsweetServer, submitter)
const tmpPath = await createTempDir()
tmpPath = await createTempDir()
const tmpPathExt = await extractFiles(packagePath, tmpPath)
// console.log(tmpPathExt)
const parsedInfo = await parseManifest(
......@@ -174,7 +178,7 @@ async function runProcess(packagePath) {
const xmlObj = await parseXml(parsedInfo.metaXml)
// const convertedManuscript = convertFromInk(pubsweetServer, parsedInfo, token)
const manuscriptDb = await createManuscript(
manuscriptDb = await createManuscript(
pubsweetServer,
xmlObj,
parsedInfo,
......@@ -185,13 +189,16 @@ async function runProcess(packagePath) {
)
await tidyUp(packagePath, tmpPath, manuscriptDb)
} catch (error) {
if (error.submitter) {
bulkUploaderEmail(error.submitter.email, error.message)
if (submitter) {
bulkUploaderEmail(
submitter.email,
'Something went wrong with the file uploading.',
)
}
errorDevEmail(`Error with ftp-integration - api.js
Error: ${error}`)
logger.error('Error with ftp-integration - api.js', error.stack)
await tidyUp(error.filePath, error.tmpPath, error.manId, true)
await tidyUp(packagePath, tmpPath, manuscriptDb, true)
}
}
......
exports.up = (knex, Promise) =>
knex.schema.alterTable('file', t => {
t.string('label', 200).alter()
})
exports.down = (knex, Promise) =>
knex.schema.alterTable('file', t => {
t.string('label').alter()
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment