Bad response when sending doc and xls attachment from Jira to SN

Originally asked by Andrew on 05 February 2021 (original question)


Hello,

While sending doc and xls file from Jira SD to SN, I got below error:

Bad response when Adding attachment ITC-Handbook.doc - 400 {“error”:{“detail”:null,“message”:“Invalid file type: application/msword”},“status”:“failure”}

It was possible to attach in Jira earlier to the same ticket files pptx or xlsx and send the files to SN.
It is also possible to attach doc and xls files in SN ticket and send files to Jira.
SN property glide.attachment.extension contains among others xlsx,xls,doc,docx,ppt,pptx.

Error stack below:

com.exalate.api.exception.IssueTrackerException: Bad response when Adding attachment ITC-Handbook.doc - 400 {“error”:{“detail”:null,“message”:“Invalid file type: application/msword”},“status”:“failure”} at services.node.client.ServiceNowClient.filterResponse(ServiceNowClient.scala:763) at services.node.client.ServiceNowClient.$anonfun$addAttachment$12(ServiceNowClient.scala:443) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:56) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:93) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:93) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)


Answer by André Leroy-Beaulieu Castro on 10 February 2021

Hi Andrew,

It definitely seems related to the glide.security.file.mime_type.validation property in your ServiceNow, is the only option to configure this property to completely enable and disable it? (true/false).

If there is a possibility to add an allowed MIME type to this validation? If you could add “application/msword” (for doc) and application/vnd.ms-excel (for xls)then I’m sure it will start working :smile:

Thanks,

André


Comments:

Andrew commented on 08 February 2021

I did one test and deactivated SN property glide.security.file.mime_type.validation and I was able to get in SN doc file sent from Jira.
What I read, glide.security.file.mime_type.validation is “checking of MIME type / magic bytes during file uploads”
(but here “uploads” means probably files sent to SN from external sources, not added to INC via SN GUI).

So I wonder why I am able to get in SN docx and xlsx files, but not doc and xls ?

I am working on SN Paris release in Firefox.