pnp / sp-dev-fx-controls-react

Reusable React controls for SPFx solutions
https://pnp.github.io/sp-dev-fx-controls-react/
MIT License
380 stars 379 forks source link

FilePicker can't browse "Your organisation" tab when used in webpart on the root/home SharePoint site #1766

Open stevesuk opened 4 months ago

stevesuk commented 4 months ago

Category

[ ] Enhancement [X] Bug [ ] Question

Version

Please specify what version of the library you are using: [3.17.0]

Expected / Desired Behavior / Question

When editing a content page on the root SharePoint site, when I open the FilePicker control and click the "Your organisation" tab, and then "Images" - I expect to see a list of the files/folders from my org assets image library.

Observed Behavior

On root/home SharePoint site, it doesn't work - and you instead see a spinner icon, with an error logged in the debug console. This only happens on the root/home site. If I use the control on any other site in my SharePoint tenant, it works.

Steps to Reproduce

Create a page in the root/home site of SharePoint, and add a webpart that uses the FilePicker control, and try to browse to Images on the "Your organisation" tab.

More information:

I think the fact the page is being created on the home site (and not within a site that has a Url beginning /sites/my-site/) is confusing the code that builds the Url to fetch the org assets listing from the API.

When using the home/root site, it tries to use this Url to fetch the folder/file list from the org assets image library - which fails:

https://MYTENANT.sharepoint.com/_api/SP.List.GetListDataAsStream?listFullUrl=%27https://MYTENANT.sharepoint.com/sites/OrgAssetssites%27&RootFolder=sites/OrgAssets/ACMEImages

When on a normal site, it uses this Url, which works:

https://MYTENANT.sharepoint.com/sites/MYSITE/_api/SP.List.GetListDataAsStream?listFullUrl=%27https://MYTENANT.sharepoint.com/sites/OrgAssets/ACMEImages%27&RootFolder=/sites/OrgAssets/ACMEImages

On the first link, there seems to be some corruption around the area of /OrgAssetssites%27 (our library is called OrgAssets, but its appended the word "sites" on to the end).

Thank you!

ghost commented 4 months ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.