Issue with CheckFileInfo endpoint

147 views Asked by At

So we are a cloud-storage partner, and my CheckFileInfo is called by office online, but after that, I was under the impression that the wopi/files/{id}/contents endpoint should be hit, but it just never gets to that point. I've checked several different checkFileInfo implementations and can't figure out the issue. Is there something I am missing?

This is the endpoint implementation (thanks to this repository https://github.com/petrsvihlik/WopiHost)

[HttpGet("wopi/files/{id}")]
public async Task<IActionResult> GetCheckFileInfo(string id)
{
    IWopiFile wopiFile = wopiStorageProvider.GetWopiFile(id);
    JsonResult checkFileInfoView = new JsonResult(wopiFile.GetCheckFileInfo(null, HostCapabilities), null);
    return new JsonResult(wopiFile.GetCheckFileInfo(null, HostCapabilities), null);
}

Here is the json, that is returned:

{
    "baseFileName": "test.docx",
    "ownerId": "test1",
    "size": 14058,
    "userId": "test1",
    "version": "2023-02-20T13:46:36",
    "lastModifiedTime": "2023-02-20T13:46:36.3436458Z",
    "fileExtension": ".docx",
    "fileNameMaxLength": 0,
    "breadcrumbBrandName": null,
    "breadcrumbBrandUrl": null,
    "breadcrumbDocName": null,
    "breadcrumbDocUrl": null,
    "breadcrumbFolderName": null,
    "breadcrumbFolderUrl": null,
    "clientUrl": null,
    "closeButtonClosesWindow": false,
    "closeUrl": null,
    "disableBrowserCachingOfUserContent": false,
    "allowAdditionalMicrosoftServices": false,
    "allowErrorReportPrompt": false,
    "allowExternalMarketplace": false,
    "disablePrint": false,
    "disableTranslation": false,
    "downloadUrl": null,
    "fileEmbedCommandUrl": null,
    "fileSharingUrl": null,
    "fileUrl": null,
    "fileVersionUrl": null,
    "hostAuthenticationId": null,
    "hostEditUrl": null,
    "hostEmbeddedEditUrl": null,
    "hostEmbeddedViewUrl": null,
    "hostName": null,
    "hostNotes": null,
    "hostRestUrl": null,
    "hostViewUrl": null,
    "irmPolicyDescription": null,
    "irmPolicyTitle": null,
    "presenceProvider": null,
    "presenceUserId": null,
    "privacyUrl": null,
    "protectInClient": false,
    "signInUrl": null,
    "readOnly": false,
    "restrictedWebViewOnly": false,
    "sha256": "k50Ci3h/VE0klyULDGaQLvH3RWWMLgHqkxQXURRmeSc=",
    "uniqueContentId": null,
    "signoutUrl": null,
    "supportsCoauth": true,
    "supportsCobalt": false,
    "supportsFolders": false,
    "supportsContainers": false,
    "supportsLocks": false,
    "supportsGetLock": false,
    "supportsExtendedLockLength": false,
    "supportsEcosystem": false,
    "supportsGetFileWopiSrc": false,
    "supportedShareUrlTypes": null,
    "supportsScenarioLinks": false,
    "supportsSecureStore": false,
    "supportsFileCreation": false,
    "supportsUpdate": false,
    "supportsRename": false,
    "supportsDeleteFile": false,
    "supportsUserInfo": false,
    "userInfo": null,
    "tenantId": null,
    "termsOfUseUrl": null,
    "timeZone": null,
    "isAnonymousUser": true,
    "isEduUser": false,
    "licenseCheckForEditIsEnabled": false,
    "userCanAttend": false,
    "userCanNotWriteRelative": false,
    "userCanPresent": false,
    "userCanWrite": false,
    "userCanRename": false,
    "userFriendlyName": null,
    "userPrincipalName": null,
    "webEditingDisabled": false
}

This would be the endpoint, that I would expect to be hit right after returning from checkFileInfo:

/// <returns></returns>
[HttpGet("wopi/files/{id}/contents")]
public async Task<IActionResult> GetFile(string id)
{  
    IWopiFile wopiFile = wopiStorageProvider.GetWopiFile(id);
    return new FileStreamResult(wopiFile.GetReadStream(), "application/octet-stream");
}

Is there a missinterpretation regarding the endpoint calls or is my implementation missing something?

1

There are 1 answers

0
rocky On

Can you check whether there are any incoming requests to the WopiHost at all? Maybe they get filtered out by the AuthNZ middleware.

Try putting breakpoints in the WopiAuthorizationHandler and the AccessTokenHandler and see if they get hit and what happens next.