EBMS Tickets

Issue Number 383
Summary [Admin] Problem Uploading Docs from Word 2016
Created 2016-05-31 17:00:17
Issue Type Bug
Submitted By Juthe, Robin (NIH/NCI) [E]
Assigned To zhangy41
Status Closed
Resolved 2016-06-28 12:23:34
Resolution Fixed
Path /home/bkline/backups/jira/oceebms/issue.185208
Description

We're running into problems uploading documents from Word 2016. Here is a sample error message:

e
Error message
Genetics of Endocrine and Neuroendocrine Neoplasias test.docx is not of type application/msword.

We get this error message regardless of whether we save the Word doc with the option to "maintain compatibility settings with previous versions of Word" selected.

The workaround we are using for the time being is to save Word docs using the older Word 1997-2003 type (.doc). I don't think we can expect our Board members to do the same, so that's why I've given this a high priority.

Comment entered 2016-06-06 19:39:41 by henryec

Porting comments from email over into JIRA...
On Mon, Jun 6, 2016 at 11:42 AM, Zhang, Yijun (NIH/NCI) <yijun.zhang@nih.gov> wrote:

Also I didn’t have any access to EBMS so far. In usual situation, drupal won’t validate the file format as long as the extension (.docx) are allowed. But based on the error message the client reported in the ticket: https://tracker.nci.nih.gov/browse/OCEEBMS-383 It reads:

Genetics of Endocrine and Neuroendocrine Neoplasias test.docx is not of type application/msword.

Seems EBMS did some special treatment on file format validation. Did it use the contrib module mimedetect??

https://www.drupal.org/project/mimedetect

If so, we need to make a patch to that contrib module to add Word 2016 Magic string to magic.mime file so it can recognize Word 2016 format. This contrib module hasn’t been maintained for long time. The last dev version is 2013-Oct-01.

Comment entered 2016-06-06 19:42:17 by henryec

From: Kline, Robert (NCI)
Sent: Monday, June 06, 2016 12:28 PM
To: Zhang, Yijun (NIH/NCI)
Subject: Re: EBMS

Yijun:
 
There's a couple of places which will need modification for this.
 
https://ncisvn.nci.nih.gov/svn/oce_cdr/trunk/ebms/ebms.nci.nih.gov/modules/custom/ebms/docs.inc
 
In the pdq_ebms_post_doc_form_validate() function, at line 556, the code

        if ($mime_type == "application/$word_xml")
            $mime_type = 'application/msword';

needs to be hoisted out from the if ($values['doc']) {} block and moved to right in front of the "// Get the filename extension." comment.

That same code needs to be added to
 
https://ncisvn.nci.nih.gov/svn/oce_cdr/trunk/ebms/ebms.nci.nih.gov/modules/custom/ebms/reports.inc
 
right after calling get_mime_type() at line 5094 (yes, it's a big file, but not the biggest in the EBMS by quite a bit).
 
Thanks,
Bob
Comment entered 2016-06-06 19:43:12 by henryec

On Mon, Jun 6, 2016 at 12:42 PM, Zhang, Yijun (NIH/NCI) <yijun.zhang@nih.gov> wrote:

Bob,

Seems EBMS using its own solution for file validation. So I cannot provide any help or diagnostic until I set up the EBMS in my local and get access to the entire code base. Are you able to provide the local dev set up instruction for EBMS as I heard this system is very special so it may not work if I simply grab the db/code snapshot from your dev server.

Or, if you already have the solution to solve this problem, you can continue to work on it if it won’t impact your schedule on other project. Otherwise, if it takes you longer time (like several days), I can set up my local dev and help on this issue.

Thanks,
Yijun

Comment entered 2016-06-06 19:45:34 by henryec

From: Kline, Robert (NCI)
Sent: Monday, June 06, 2016 5:50 PM
To: Zhang, Yijun (NIH/NCI)

I've got a new branch ...

https://ncisvn.nci.nih.gov/svn/oce_cdr/branches/oceebms-383

... with the fix checked in and installed on DEV. You can have the users test on that tier, and if they're satisfied, I'll drop the fix on QA and you can work with CBIIT to get the two changed files installed on STAGE and PROD. We won't be able to do anything at all on STAGE until they fix the problem with disk space (there isn't any – I've filed a ticket: https://tracker.nci.nih.gov/browse/WEBTEAM-8657).

$ svn log -v -r 14056
------------------------------------------------------------------------
r14056 | bkline | 2016-06-06 17:38:21 -0400 (Mon, 06 Jun 2016) | 1 line
Changed paths:
   M /branches/oceebms-383/ebms.nci.nih.gov/modules/custom/ebms/docs.inc
   M /branches/oceebms-383/ebms.nci.nih.gov/modules/custom/ebms/reports.inc

workaround for shifting MS Word mime types (OCEEBMS-383)

The target directory (on all tiers) is /local/drupal/sites/ebms.nci.nih.gov/modules/custom/ebms

When it landed safely on production I'll fold the branch back into trunk and create a tag.

Thanks,
Bob

Comment entered 2016-06-13 10:50:50 by Kline, Bob (NIH/NCI) [C]

I have merged the branch back into trunk, deleted the branch, and created a tag for the patch (3.2.1).

Comment entered 2016-08-11 10:04:09 by Juthe, Robin (NIH/NCI) [E]

This is working well on PROD, so I'm closing this issue.

Elapsed: 0:00:00.000624