Office-js: OfficeJS initialization error on documents with apostrophes in their name

Created on 23 Sep 2019  路  8Comments  路  Source: OfficeDev/office-js


If the document opened in Word contains an apostrophe in its filename, OfficeJS fails to load successfully, and the entire initialization process that follows is stopped completely.

Expected Behavior


I expect OfficeJS to load successfully regardless of the document's filename.

Current Behavior



OfficeJS does not load successfully. The error is quite cryptic:

SCRIPT1004: SCRIPT1004: Expected ';'

The add-in cannot continue to load, and all we see is a white screen.

Steps to Reproduce, or Live Example



  • Additional details:

    1. npm install

    2. npm start

    3. Sideload the provided manifest

    4. Open the sample document provided, named Sam's Document.docx

    5. Open the add-in task pane, and attach the debugger

    6. Notice the error

    7. Notice, the code that follows the OfficeJS load is not run

Context



We have quite a large number of documents that have an apostrophe in their filenames, and not being able to load our add-in due to this is obviously a huge problem for our clients.

Your Environment

  • Platform: PC desktop
  • Host: Word
  • Office version number: Word 2016 for Windows Version 1910 (Build 12112.20000 Click-to-Run), Office Insider
  • Operating System: Windows 10 Version 1903 (OS Build 18362.356)
  • Browser (if using Office Online): N/A

Useful logs

  • [x] Console errors
SCRIPT1004: SCRIPT1004: Expected ';'

Notes

  • if I hard-reload the add-in while the Edge DevTools debugger is open, this error is not logged, but the add-in remains stuck.
  • rename the file and remove the apostrophe, then start up the add-in again. You should see:
SUCCESS: OfficeJS loaded on Word PC
  • OfficeJS loads successfully on Word Online regardless of whether the filename contains an apostrophe or not.
Edge WebView fixed product bug

Most helpful comment

Just a quick update, this week we should get a build in Office Insiders that contains this fix.

All 8 comments

Thanks @TheSamsterZA for reporting this issue.

You mentioned "Host" as "Word" but "Office version" as "Office version number: Outlook 2016 for Windows Version 1910". Is this issue applicable to only "Word" or this scenario is possible in "Outlook" as well? This information will help me redirect this issue to correct team internally.

@exextoc thank you for the response.

Apologies, that was a typo on my part. I have updated my initial post with the correct host.

I noticed this issue on Word. I have not tried to test this in Outlook via crafting a mail item with (possibly?) a subject that contains apostrophes, but if you believe the issue affects all hosts, then please let me know and I'll spend some time trying to replicate on Outlook.

I spent some time trying to pin down exactly when this bug was introduced, although I have limited knowledge of Microsoft's release process. Here is what I found:

The bug is NOT present in Office Version 1908 (Build 11929.20300 Click-to-Run), Monthly Channel1

The bug IS present in Office Version 1909 (Build 12026.20190 Click-to-Run, Monthly Channel (Targeted)2

1 The PC I tested this on was on Windows 10 Version 1809 (OS Build 17763.737), so Office would be using IE11 instead of Edge.
2The PC I tested this on was on Windows 10 Version 1903 (OS Build 18362.356), so Office would be using Edge instead of IE11.

I am fairly certain that the browser does not make a difference to causing this bug, though.

Thanks @TheSamsterZA for testing this and providing these additional details. We are looking into this and will update you soon on this.

@TheSamsterZA - as always, thanks for reporting this. I have a fix in review and will update here once I have a build to share that contains the fix.

Just a quick update, this week we should get a build in Office Insiders that contains this fix.

@TheSamsterZA - the fix should be available for you to test in Office Insiders build 16.0.12130.20112 or newer. Please let me know once you're able to verify.

@jargil I can confirm that this now-infamous apostrophe bug has been fixed! Thank you for jumping on this fairly quickly. 馃槂

Was this page helpful?
0 / 5 - 0 ratings