Skip to content

Commit

Permalink
The Url for Root-Site-API Request had // in path
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Zuellig committed Jan 15, 2025
1 parent 2d45852 commit 5f2f99d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public FieldLink()
var arguments = new Uri(api.ApiCall.Request).Query;
arguments ??= "";

api.ApiCall = new ApiCall($"{PnPContext.Uri.AbsoluteUri}/_api/Web/Lists(guid'{(Parent.Parent.Parent as IList).Id}')/ContentTypes('{(Parent as IContentType).StringId}')/FieldLinks{arguments}", api.ApiCall.Type, api.ApiCall.JsonBody, api.ApiCall.ReceivingProperty);
api.ApiCall = new ApiCall($"{PnPContext.Uri.AbsoluteUri.TrimEnd('/')}/_api/Web/Lists(guid'{(Parent.Parent.Parent as IList).Id}')/ContentTypes('{(Parent as IContentType).StringId}')/FieldLinks{arguments}", api.ApiCall.Type, api.ApiCall.JsonBody, api.ApiCall.ReceivingProperty);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/sdk/PnP.Core/Model/SharePoint/Core/Internal/File.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,14 @@ public async Task<Stream> GetContentAsync(bool streamContent = false)
{
// for WASM we use the browser's network stack and need to comply to CORS policies
// hence we're not using the download.aspx page approach here
downloadUrl = $"{PnPContext.Uri}/_api/Web/getFileById('{UniqueId}')/$value";
downloadUrl = $"{PnPContext.Uri.AbsoluteUri.TrimEnd('/')}/_api/Web/getFileById('{UniqueId}')/$value";
}
else
{
downloadUrl = $"{PnPContext.Uri}/_layouts/15/download.aspx?UniqueId={UniqueId}";
downloadUrl = $"{PnPContext.Uri.AbsoluteUri.TrimEnd('/')}/_layouts/15/download.aspx?UniqueId={UniqueId}";
}
#else
string downloadUrl = $"{PnPContext.Uri}/_layouts/15/download.aspx?UniqueId={UniqueId}";
string downloadUrl = $"{PnPContext.Uri.AbsoluteUri.TrimEnd('/')}/_layouts/15/download.aspx?UniqueId={UniqueId}";
#endif

var apiCall = new ApiCall(downloadUrl, ApiType.SPORest)
Expand Down
4 changes: 2 additions & 2 deletions src/sdk/PnP.Core/Model/SharePoint/Core/Internal/ListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public ListItem()
AddApiCallHandler = async (keyValuePairs) =>
{
var parentList = Parent.Parent as List;
var parentListUri = $"{PnPContext.Uri.AbsoluteUri}/_api/Web/Lists(guid'{parentList.Id}')";
var parentListUri = $"{PnPContext.Uri.AbsoluteUri.TrimEnd('/')}/_api/Web/Lists(guid'{parentList.Id}')";

// Define the JSON body of the update request based on the actual changes
dynamic body = new ExpandoObject();
Expand Down Expand Up @@ -582,7 +582,7 @@ private async Task<ApiCall> BuildUpdateApiCallAsync(PnPContext context)
entityInfo.Target = Parent.GetType();
}

var itemUri = $"{PnPContext.Uri}/{entityInfo.SharePointUri}";
var itemUri = $"{PnPContext.Uri.AbsoluteUri.TrimEnd('/')}/{entityInfo.SharePointUri}";

// Prepare the variable to contain the target URL for the update operation
var updateUrl = await ApiHelper.ParseApiCallAsync(this, $"{itemUri}/ValidateUpdateListItem").ConfigureAwait(false);
Expand Down

0 comments on commit 5f2f99d

Please sign in to comment.