Skip to content

Commit 19a6b74

Browse files
committed
Bugfix where relative URLs would no longer work due to this change
1 parent 8967ab2 commit 19a6b74

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Commands/Files/GetFile.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.SharePoint.Client;
22
using PnP.Core.Model.SharePoint;
33
using PnP.Framework.Utilities;
4+
using System;
45
using System.IO;
56
using System.Management.Automation;
67
using System.Threading.Tasks;
@@ -66,9 +67,12 @@ protected override void ExecuteCmdlet()
6667
}
6768
}
6869

69-
// We can't deal with absolute URLs
70-
Url = UrlUtility.MakeRelativeUrl(Url);
71-
70+
if (Uri.IsWellFormedUriString(Url, UriKind.Absolute))
71+
{
72+
// We can't deal with absolute URLs
73+
Url = UrlUtility.MakeRelativeUrl(Url);
74+
}
75+
7276
// Remove URL decoding from the Url as that will not work. We will encode the + character specifically, because if that is part of the filename, it needs to stay and not be decoded.
7377
Url = Utilities.UrlUtilities.UrlDecode(Url.Replace("+", "%2B"));
7478

0 commit comments

Comments
 (0)