diff --git a/NotionSharp.ApiClient.Tests/TestNotionBase.cs b/NotionSharp.ApiClient.Tests/TestNotionBase.cs index 0b90e1f..793aacc 100644 --- a/NotionSharp.ApiClient.Tests/TestNotionBase.cs +++ b/NotionSharp.ApiClient.Tests/TestNotionBase.cs @@ -251,4 +251,14 @@ public async Task TestPageAndChildrenDeserialization() Assert.IsNotNull(blocks); } + [TestMethod] + public void TestNotionUtils() + { + var baseUri = new Uri("https://vapolia.notion.site"); + var title = "Creating a good Xamarin Forms Control Part 2 UI Day 3"; + var pageId = "a1744f66-81bf-41a5-b93d-70cbdf6bc3db"; + var url = NotionUtils.GetPageUri(pageId, title, baseUri).ToString(); + Assert.AreEqual("https://vapolia.notion.site/Creating-a-good-Xamarin-Forms-Control-Part-2-UI-Day-3-a1744f6681bf41a5b93d70cbdf6bc3db", url); + } + } \ No newline at end of file diff --git a/NotionSharp.ApiClient/Lib/Helpers/NotionUtils.cs b/NotionSharp.ApiClient/Lib/Helpers/NotionUtils.cs index 5824730..6731fc3 100644 --- a/NotionSharp.ApiClient/Lib/Helpers/NotionUtils.cs +++ b/NotionSharp.ApiClient/Lib/Helpers/NotionUtils.cs @@ -13,7 +13,7 @@ public static class NotionUtils public static Uri GetPageUri(string pageId, string? title, Uri baseUrl) { var pageTitle = Uri.EscapeDataString(TrimSpaces.Replace(title ?? "", "-")); - pageId = pageId.Trim('-'); + pageId = pageId.Replace("-", string.Empty); return new(baseUrl, $"{pageTitle}-{pageId}"); } diff --git a/NotionSharp.ApiClient/NotionSharp.ApiClient.csproj b/NotionSharp.ApiClient/NotionSharp.ApiClient.csproj index 14417d0..5aca223 100644 --- a/NotionSharp.ApiClient/NotionSharp.ApiClient.csproj +++ b/NotionSharp.ApiClient/NotionSharp.ApiClient.csproj @@ -19,7 +19,7 @@ 2.0.0 - -pre4 + -pre5 $(DefineConstants);