Skip to content

fix: passing decoded URL to GetFolderByServerRelativePath#59

Open
wesleyzloza wants to merge 1 commit intokoltyakov:devfrom
wesleyzloza:dev
Open

fix: passing decoded URL to GetFolderByServerRelativePath#59
wesleyzloza wants to merge 1 commit intokoltyakov:devfrom
wesleyzloza:dev

Conversation

@wesleyzloza
Copy link

Closes #56. Using decoded folder path(s) for SharePoint ResourcePath API. This appears to fix an issue with recursive scanning of folders a root directory.

@wesleyzloza
Copy link
Author

Well that is odd... It is working as expected on my end but showing invalid URL errors in your testing.

@koltyakov
Copy link
Owner

koltyakov commented Jun 4, 2021

Thank you Wesley!

I take a look over the weekend.

Please confirm, is your environment SharePoint 2013?

I’m not sure I tested in 2013 after v2.4.0 or something, only SPO. Good catch to verify in older versions which didn’t support modern API methods.

@wesleyzloza
Copy link
Author

My sites are using SharePoint Online which makes the whole situation even more odd especially because you are testing for that environment. I'm not sure if this helps but this is the data collected from my site using the _api/web entry point.

<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="https://company.sharepoint.com/sites/siteName/_api/"
  xmlns="http://www.w3.org/2005/Atom"
  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
  xmlns:georss="http://www.georss.org/georss"
  xmlns:gml="http://www.opengis.net/gml">
  <id>https://company.sharepoint.com/sites/siteName/_api/Web</id>
  <category term="SP.Web" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <link rel="edit" href="Web" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FirstUniqueAncestorSecurableObject" type="application/atom+xml;type=entry" title="FirstUniqueAncestorSecurableObject" href="Web/FirstUniqueAncestorSecurableObject" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleAssignments" type="application/atom+xml;type=feed" title="RoleAssignments" href="Web/RoleAssignments" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AccessRequestsList" type="application/atom+xml;type=entry" title="AccessRequestsList" href="Web/AccessRequestsList" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/Activities" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ActivityLogger" type="application/atom+xml;type=entry" title="ActivityLogger" href="Web/ActivityLogger" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Alerts" type="application/atom+xml;type=feed" title="Alerts" href="Web/Alerts" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AllProperties" type="application/atom+xml;type=entry" title="AllProperties" href="Web/AllProperties" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AppTiles" type="application/atom+xml;type=feed" title="AppTiles" href="Web/AppTiles" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AssociatedMemberGroup" type="application/atom+xml;type=entry" title="AssociatedMemberGroup" href="Web/AssociatedMemberGroup" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AssociatedOwnerGroup" type="application/atom+xml;type=entry" title="AssociatedOwnerGroup" href="Web/AssociatedOwnerGroup" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AssociatedVisitorGroup" type="application/atom+xml;type=entry" title="AssociatedVisitorGroup" href="Web/AssociatedVisitorGroup" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Author" type="application/atom+xml;type=entry" title="Author" href="Web/Author" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AvailableContentTypes" type="application/atom+xml;type=feed" title="AvailableContentTypes" href="Web/AvailableContentTypes" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AvailableFields" type="application/atom+xml;type=feed" title="AvailableFields" href="Web/AvailableFields" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CanModernizeHomepage" type="application/atom+xml;type=entry" title="CanModernizeHomepage" href="Web/CanModernizeHomepage" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ClientWebParts" type="application/atom+xml;type=feed" title="ClientWebParts" href="Web/ClientWebParts" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentTypes" type="application/atom+xml;type=feed" title="ContentTypes" href="Web/ContentTypes" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CurrentUser" type="application/atom+xml;type=entry" title="CurrentUser" href="Web/CurrentUser" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/DataLeakagePreventionStatusInfo" type="application/atom+xml;type=entry" title="DataLeakagePreventionStatusInfo" href="Web/DataLeakagePreventionStatusInfo" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/DescriptionResource" type="application/atom+xml;type=entry" title="DescriptionResource" href="Web/DescriptionResource" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/EventReceivers" type="application/atom+xml;type=feed" title="EventReceivers" href="Web/EventReceivers" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Features" type="application/atom+xml;type=feed" title="Features" href="Web/Features" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Fields" type="application/atom+xml;type=feed" title="Fields" href="Web/Fields" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/Folders" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/HostedApps" type="application/atom+xml;type=entry" title="HostedApps" href="Web/HostedApps" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Lists" type="application/atom+xml;type=feed" title="Lists" href="Web/Lists" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListTemplates" type="application/atom+xml;type=feed" title="ListTemplates" href="Web/ListTemplates" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/MultilingualSettings" type="application/atom+xml;type=entry" title="MultilingualSettings" href="Web/MultilingualSettings" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Navigation" type="application/atom+xml;type=entry" title="Navigation" href="Web/Navigation" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/OneDriveSharedItems" type="application/atom+xml;type=feed" title="OneDriveSharedItems" href="Web/OneDriveSharedItems" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentWeb" type="application/atom+xml;type=entry" title="ParentWeb" href="Web/ParentWeb" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/PushNotificationSubscribers" type="application/atom+xml;type=feed" title="PushNotificationSubscribers" href="Web/PushNotificationSubscribers" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RecycleBin" type="application/atom+xml;type=feed" title="RecycleBin" href="Web/RecycleBin" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RegionalSettings" type="application/atom+xml;type=entry" title="RegionalSettings" href="Web/RegionalSettings" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleDefinitions" type="application/atom+xml;type=feed" title="RoleDefinitions" href="Web/RoleDefinitions" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RootFolder" type="application/atom+xml;type=entry" title="RootFolder" href="Web/RootFolder" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SiteCollectionAppCatalog" type="application/atom+xml;type=entry" title="SiteCollectionAppCatalog" href="Web/SiteCollectionAppCatalog" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SiteGroups" type="application/atom+xml;type=feed" title="SiteGroups" href="Web/SiteGroups" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SiteUserInfoList" type="application/atom+xml;type=entry" title="SiteUserInfoList" href="Web/SiteUserInfoList" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SiteUsers" type="application/atom+xml;type=feed" title="SiteUsers" href="Web/SiteUsers" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/TenantAppCatalog" type="application/atom+xml;type=entry" title="TenantAppCatalog" href="Web/TenantAppCatalog" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ThemeInfo" type="application/atom+xml;type=entry" title="ThemeInfo" href="Web/ThemeInfo" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/TitleResource" type="application/atom+xml;type=entry" title="TitleResource" href="Web/TitleResource" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/UserCustomActions" type="application/atom+xml;type=feed" title="UserCustomActions" href="Web/UserCustomActions" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Webs" type="application/atom+xml;type=feed" title="Webs" href="Web/Webs" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/WebInfos" type="application/atom+xml;type=feed" title="WebInfos" href="Web/WebInfos" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/WorkflowAssociations" type="application/atom+xml;type=feed" title="WorkflowAssociations" href="Web/WorkflowAssociations" />
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/WorkflowTemplates" type="application/atom+xml;type=feed" title="WorkflowTemplates" href="Web/WorkflowTemplates" />
  <title />
  <updated>2021-06-04T15:09:20Z</updated>
  <author>
    <name />
  </author>
  <content type="application/xml">
    <m:properties>
      <d:AllowRssFeeds m:type="Edm.Boolean">true</d:AllowRssFeeds>
      <d:AlternateCssUrl></d:AlternateCssUrl>
      <d:AppInstanceId m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:AppInstanceId>
      <d:ClassicWelcomePage m:null="true" />
      <d:Configuration m:type="Edm.Int16">0</d:Configuration>
      <d:Created m:type="Edm.DateTime">2018-06-20T15:06:52.83</d:Created>
      <d:CurrentChangeToken m:type="SP.ChangeToken">
        <d:StringValue></d:StringValue>
      </d:CurrentChangeToken>
      <d:CustomMasterUrl>/sites/siteName/_catalogs/masterpage/seattle.master</d:CustomMasterUrl>
      <d:Description>Site Description</d:Description>
      <d:DesignPackageId m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:DesignPackageId>
      <d:DocumentLibraryCalloutOfficeWebAppPreviewersDisabled m:type="Edm.Boolean">false</d:DocumentLibraryCalloutOfficeWebAppPreviewersDisabled>
      <d:EnableMinimalDownload m:type="Edm.Boolean">false</d:EnableMinimalDownload>
      <d:FooterEmphasis m:type="Edm.Int32">0</d:FooterEmphasis>
      <d:FooterEnabled m:type="Edm.Boolean">false</d:FooterEnabled>
      <d:FooterLayout m:type="Edm.Int32">0</d:FooterLayout>
      <d:HeaderEmphasis m:type="Edm.Int32">0</d:HeaderEmphasis>
      <d:HeaderLayout m:type="Edm.Int32">2</d:HeaderLayout>
      <d:HideTitleInHeader m:type="Edm.Boolean">false</d:HideTitleInHeader>
      <d:HorizontalQuickLaunch m:type="Edm.Boolean">false</d:HorizontalQuickLaunch>
      <d:Id m:type="Edm.Guid"></d:Id>
      <d:IsHomepageModernized m:type="Edm.Boolean">false</d:IsHomepageModernized>
      <d:IsMultilingual m:type="Edm.Boolean">true</d:IsMultilingual>
      <d:IsRevertHomepageLinkHidden m:type="Edm.Boolean">false</d:IsRevertHomepageLinkHidden>
      <d:KeepFieldUserResources m:type="Edm.Boolean">false</d:KeepFieldUserResources>
      <d:Language m:type="Edm.Int32">1033</d:Language>
      <d:LastItemModifiedDate m:type="Edm.DateTime">2021-06-04T15:09:11Z</d:LastItemModifiedDate>
      <d:LastItemUserModifiedDate m:type="Edm.DateTime">2021-06-04T14:40:42Z</d:LastItemUserModifiedDate>
      <d:LogoAlignment m:type="Edm.Int32">0</d:LogoAlignment>
      <d:MasterUrl>/sites/siteName/_catalogs/masterpage/seattle.master</d:MasterUrl>
      <d:MegaMenuEnabled m:type="Edm.Boolean">false</d:MegaMenuEnabled>
      <d:NavAudienceTargetingEnabled m:type="Edm.Boolean">false</d:NavAudienceTargetingEnabled>
      <d:NoCrawl m:type="Edm.Boolean">false</d:NoCrawl>
      <d:ObjectCacheEnabled m:type="Edm.Boolean">false</d:ObjectCacheEnabled>
      <d:OverwriteTranslationsOnChange m:type="Edm.Boolean">false</d:OverwriteTranslationsOnChange>
      <d:ResourcePath m:type="SP.ResourcePath">
        <d:DecodedUrl>https://company.sharepoint.com/sites/siteName</d:DecodedUrl>
      </d:ResourcePath>
      <d:QuickLaunchEnabled m:type="Edm.Boolean">true</d:QuickLaunchEnabled>
      <d:RecycleBinEnabled m:type="Edm.Boolean">true</d:RecycleBinEnabled>
      <d:SearchScope m:type="Edm.Int32">0</d:SearchScope>
      <d:ServerRelativeUrl>/sites/siteName</d:ServerRelativeUrl>
      <d:SiteLogoUrl>/sites/siteName/_api/GroupService/GetGroupImage?id=''&amp;hash=</d:SiteLogoUrl>
      <d:SyndicationEnabled m:type="Edm.Boolean">true</d:SyndicationEnabled>
      <d:TenantAdminMembersCanShare m:type="Edm.Int32">0</d:TenantAdminMembersCanShare>
      <d:Title>RJ Environmental</d:Title>
      <d:TreeViewEnabled m:type="Edm.Boolean">false</d:TreeViewEnabled>
      <d:UIVersion m:type="Edm.Int32">15</d:UIVersion>
      <d:UIVersionConfigurationEnabled m:type="Edm.Boolean">false</d:UIVersionConfigurationEnabled>
      <d:Url>https://company.sharepoint.com/sites/siteName</d:Url>
      <d:WebTemplate>GROUP</d:WebTemplate>
      <d:WelcomePage>SitePages/Home.aspx</d:WelcomePage>
    </m:properties>
  </content>
</entry>

@koltyakov
Copy link
Owner

koltyakov commented Jun 8, 2021

Hi @wesleyzloza,

this.utils.escapeURIComponent is actually needed for modern API as well. Otherwise a simple test with a folder containing apostrophe (which is pretty common) will fail.

Could you please check the file and folder names for something unusual? Any special chars.

We'd place these special chars cases to asset names and into test cases.

@wesleyzloza
Copy link
Author

I do not have any special characters in my folder names. I think you are right that you have to escape any apostrophes but I don't think you need to encode the URL. Most of the searches I've made suggest escaping apostrophes/single quotes with two of them ,'' , and not %27.

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.

2 participants