Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fix shared links previewed in other subdomains #173

Merged
merged 3 commits into from
Jun 20, 2017
Merged

Fix: Fix shared links previewed in other subdomains #173

merged 3 commits into from
Jun 20, 2017

Conversation

jeremypress
Copy link
Contributor

No description provided.

let src = `${appHost}/integrations/officeonline/openExcelOnlinePreviewer`;
let runmodeSrc = '/integrations/officeonline/openExcelOnlinePreviewer';

const domain = document.createElement('a');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking - will this cause issues on IE like that bug you found a few weeks ago?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. Is there a reason why we created an tag an didn't just use window.location to begin with?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a tag lets us leverage the browser when parsing out different parts of the domain

@@ -184,25 +184,28 @@ const MESSAGE_HOST_READY = 'Host_PostmessageReady';
*/
setupRunmodeURL(appHost, fileId, sharedLink) {
// @TODO(jpress): Combine with setupWopiSrc Logic when removing the platform fork
let src = `${appHost}/integrations/officeonline/openExcelOnlinePreviewer`;
let runmodeSrc = '/integrations/officeonline/openExcelOnlinePreviewer';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"route" might be a better name for this, just because a runmode isn't actually included in the src URL we build

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - we also shouldn't have Box-specific language in our code if possible.

);
});
});

describe('setupWOPISrc()', () => {
it('should append the file ID if there is no shared link', () => {
const src = office.setupWOPISrc(office.options.apiHost, office.options.file.id, office.options.sharedLink);
expect(src).to.equal('app.box.com/wopi/files/123');
expect(src).to.equal('https://app.box.com/wopi/files/123');
});

it('should append the shared name and file ID if there is a shared link', () => {
office.options.sharedLink = 'https://app.box.com/s/abcd';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a few tests for when the appHost name and the shared domain don't match? i.e. appHost = "app" and shared domain = "cloud", appHost = "ibm" and shared domain = "cloud", appHost = "cloud" and shared domain = "app"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do!

Copy link

@jedwards27 jedwards27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jeremypress jeremypress merged commit ab04be5 into box:master Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants