box-ui-elements icon indicating copy to clipboard operation
box-ui-elements copied to clipboard

Box Content Preview - Cannot override the staticHost in contentPreviewProps

Open kylefernandadams opened this issue 6 years ago • 1 comments

Environment:

  • Elements version: -- Content Preview: 1.60.0

Desktop (please complete the following information):

  • OS: macOS 10.12.6
  • Browser Chrome 71

Steps to reproduce the problem:

  1. Instantiate a new Box.Preview() instance.
  2. Modify the staticHost, staticPath, and previewLibraryVersion params
  3. Verify that that the Content Preview element is retrieving the preview.js from the new staticHost and not https://cdn01.boxcdn.net

What is the expected behavior? The Content Preview UI Element concatenates a new path leveraging the overridden staticHost, staticPath, and previewLibraryVersion props.

What went wrong? The Content Preview UI Element ignores the overridden staticHost and uses https://cdn01.boxcdn.net

Sample Code

this.boxContentExplorer = explorer.show(rootFolderId, downscopedToken, {
    container: explorerContainer,
    autoFocus: true,
    canPreview: true,
    canDownload: true,
    canUpload: true,
    canCreateNewFolder: true,
    canDelete: true,
    canRename: true,
    canShare: true,
    canSetShareAccess: true,
    contentPreviewProps: {
        staticHost: 'https://www.myfakecdn.com',
        staticPath: 'super/awesome/path/preview',
        previewLibraryVersion: '1.60.0'
    }
});

kylefernandadams avatar Jan 22 '19 23:01 kylefernandadams

Hi @kylefernandadams. I was able to recreate this issue with our latest release. We'll look into addressing this more permanently in the future, but as a workaround, you can move staticHost into the root options object:

this.boxContentExplorer = explorer.show(rootFolderId, downscopedToken, {
    container: explorerContainer,
    autoFocus: true,
    canPreview: true,
    canDownload: true,
    canUpload: true,
    canCreateNewFolder: true,
    canDelete: true,
    canRename: true,
    canShare: true,
    canSetShareAccess: true,
    contentPreviewProps: {
        staticPath: 'super/awesome/path/preview',
        previewLibraryVersion: '1.60.0'
    },
    staticHost: 'https://www.myfakecdn.com',
});

jstoffan avatar Jan 23 '19 23:01 jstoffan