OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
690 stars 95 forks source link

getFileAsync crashes password protected Word document #4866

Open filial23 opened 2 months ago

filial23 commented 2 months ago

Provide required information needed to triage your issue

Your Environment

Expected behavior

Word document protected with a password doesn't crash when calling getFileAsync.

Current behavior

Word document protected with a password crashes when calling getFileAsync.

Steps to reproduce

  1. Run Word.
  2. Enter a password to unlock the document.
  3. Sideload Word Add-in.
  4. Call requestGetFile method in the following code block.
async function request<T>({ method, officeObj, args }: { method: string; officeObj: any; args: any[] }) {
  return new Promise<T>((resolve, reject) =>
    officeObj[method](...args, (response: Office.AsyncResult<T>) => {
      if (response.status === Office.AsyncResultStatus.Failed) {
        return reject(response.error);
      }
      resolve(response.value);
    }),
  );
}

async function requestGetFile(fileType: Office.FileType = Office.FileType.Compressed): Promise<Office.File> {
  return request<Office.File>({
    method: 'getFileAsync',
    officeObj: Office.context.document,
    args: [fileType],
  });
}

Additional information

Context

This issue has a huge impact because the getFileAync method is used to provide our product's fundamental function for our clients.

Useful logs

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

filial23 commented 2 months ago

The issue doesn't happen on Version 2406 (Build 17726.20160). Any bugs would possibly be created between version 2406 and 2407.

shanshanzheng-dev commented 2 months ago

Thanks for reporting this issue. we'll take a look and report back if we have a suggestion for you.

jipyua commented 2 months ago

Thank you @filial23 for reporting this. We have reproduced this locally and was investigating the root cause of this regression. We will update this thread and let you know once we have some progress. Thanks.

jipyua commented 2 months ago

hi @filial23 , thanks for your patience. We have internally figured out the root cause and checked in the fix. Next step the fix will go through the regular valiation and release process which should be availabe to M365 current channel around early Novermber. Thanks.

filial23 commented 2 months ago

Hello @jipyua , Thanks for your investigation. It's good to hear that the fix will be released in early November! Thanks, Takafumi.