Skip to content

Commit

Permalink
reduce diff
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterITA committed Jul 1, 2024
1 parent 2864485 commit 93f106b
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,8 @@ final case class EServicesApiServiceImpl(
.leftMap(ex => InvalidZipStructure(directoryName, "Error reading configuration.json: " + ex.toString))
importedEservice <- Either
.catchNonFatal(jsonContent.parseJson.convertTo[ImportedEservice])
.leftMap(ex => InvalidZipStructure(directoryName, "Error decoding configuration.json: " + ex.toString))
.leftMap(ex => InvalidZipStructure(directoryName, "Error decoding configuration.json: " + ex.toString)
)
_ <- importedEservice.descriptor.docs.foldLeft[Either[InvalidZipStructure, Unit]](Right(())) { (acc, doc) =>
acc.flatMap(_ => fileExists(path.resolve(doc.path)))
}
Expand Down Expand Up @@ -1132,7 +1133,7 @@ final case class EServicesApiServiceImpl(
.parse(mimeType)
.leftMap(errors => ContentTypeParsingError(mimeType, file.path, errors.map(_.toString())))
.toFuture
fileParts = (FileInfo("", fileName, contentType), new File(filePath))
fileParts = (FileInfo("", fileName, contentType), new File(filePath))
_ <- verifyAndCreateEServiceDocument(
catalogProcessService,
fileManager,
Expand Down Expand Up @@ -1161,12 +1162,12 @@ final case class EServicesApiServiceImpl(
}

val result: Future[CreatedEServiceDescriptor] = for {
tenantId <- getOrganizationIdFuture(contexts)
zipFile <- fileManager.getFile(ApplicationConfiguration.importEServiceContainer)(
tenantId <- getOrganizationIdFuture(contexts)
zipFile <- fileManager.getFile(ApplicationConfiguration.importEServiceContainer)(
s"${ApplicationConfiguration.importEServicePath}/$tenantId/${fileResource.filename}"
)
zipPath <- extractZipToTempDirectory(zipFile, tenantId).toFuture
folderPath = zipPath.resolve(fileResource.filename.stripSuffix(".zip"))
zipPath <- extractZipToTempDirectory(zipFile, tenantId).toFuture
folderPath = zipPath.resolve(fileResource.filename.stripSuffix(".zip"))
importedEservice <- checkZipStructure(folderPath).toFuture.recoverWith { case ex: Throwable =>
deleteTempDirectory(zipPath)
Future.failed(ex)
Expand Down

0 comments on commit 93f106b

Please sign in to comment.