Skip to content

incorrect hasREST function behavior for Sharepoint Online / 365 #180

@vlad1025

Description

@vlad1025

First of all, thank you very much for this cool library! I use it very often in my projects!

So, now about a bug.

.hasREST function sometimes works incorrectly for SharePoint online sites.
And because of ,hasREST, some other function of $SP library fail - since they rely on hasREST().

==============================
DESCRITION:

.hasREST tries to open window.location.href.split("/").slice(0, 3).join("/") + "/_api/web/Url"

This is incorrect, because it opens ROOT company site api call. (https://[COMPANY].sharepoint.com/_api/web/Url)
And ROOT company site may be inaccessible because of lack of permission.

.hasREST should try to access the following URL: https://[COMPANY].sharepoint.com/sites/[SITENAME]_api/web/Url)

Probably you missed that location.href has "https://" with two slashes in the beginning )

"Slice(0,3)" should be replaced with "Slice(0,5)" To work correctly.

window.location.href.split("/").slice(0, 5).join("/") + "/_api/web/Url"

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions