Skip to content

Commit

Permalink
Fix: Embedded notes in Box WebApp (#788)
Browse files Browse the repository at this point in the history
Use /notes_embedded instead of /notes to resolve X-Frame-Origin issue.
  • Loading branch information
tonyjin authored May 1, 2018
1 parent 8166c25 commit 223c0b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/viewers/iframe/IFrameViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class IFrameViewer extends BaseViewer {
const { extension } = file;

if (extension === 'boxnote') {
src = `${appHost}/notes/${file.id}?isReadonly=1&is_preview=1`;
src = `${appHost}/notes_embedded/${file.id}?isReadonly=1&is_preview=1`;

// Append shared name if needed, Box Notes uses ?s=SHARED_NAME
const sharedNameIndex = sharedLink.indexOf('/s/');
Expand Down
7 changes: 5 additions & 2 deletions src/lib/viewers/iframe/__tests__/IFrameViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('lib/viewers/iframe/IFrameViewer', () => {

it('should load a boxnote and fire load event', (done) => {
iframe.on('load', () => {
assert.equal(iframe.iframeEl.src, 'https://app.box.com/notes/123?isReadonly=1&is_preview=1');
assert.equal(iframe.iframeEl.src, 'https://app.box.com/notes_embedded/123?isReadonly=1&is_preview=1');
done();
});

Expand All @@ -68,7 +68,10 @@ describe('lib/viewers/iframe/IFrameViewer', () => {
iframe.options.sharedLink = 'https://app.box.com/s/foobar';

iframe.on('load', () => {
assert.equal(iframe.iframeEl.src, 'https://app.box.com/notes/123?isReadonly=1&is_preview=1&s=foobar');
assert.equal(
iframe.iframeEl.src,
'https://app.box.com/notes_embedded/123?isReadonly=1&is_preview=1&s=foobar'
);
done();
});

Expand Down

0 comments on commit 223c0b8

Please sign in to comment.