Skip to content

Commit

Permalink
fix: assume folder if sharepoint url without query param
Browse files Browse the repository at this point in the history
  • Loading branch information
rofe committed Feb 26, 2024
1 parent c7c4a4b commit b11b91b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/extension/app/store/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export class AppStore {
const sp = new URLSearchParams(url.search);
const docPath = sp.get('id') || sp.get('RootFolder');
const dotIndex = docPath?.split('/').pop().indexOf('.');
return [-1, 0].includes(dotIndex); // dot only allowed as first char
return !docPath || [-1, 0].includes(dotIndex); // if doc path, dot can only be first char
}
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions test/app/store/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ describe('Test App Store', () => {
// test with RootFolder param
url = new URL('https://foo.sharepoint.com/sites/foo/Shared%20Documents/Forms/AllItems.aspx?RootFolder=%2Fsites%2Ffoo%2FShared%20Documents%2Fsite&viewid=87cb4d37%2D30e2%2D4762%2D87ef%2D5cd0e1059250');
expect(appStore.isSharePointFolder(url)).to.be.true;
// test with no param
url = new URL('https://foo.sharepoint.com/sites/foo/Shared%20Documents/Forms/AllItems.aspx');
expect(appStore.isSharePointFolder(url)).to.be.true;
});

it('isSharePointViewer()', async () => {
Expand Down

0 comments on commit b11b91b

Please sign in to comment.