From 0ee95e83a0baad63f42fc74a8a89e4c299f42e6f Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Tue, 24 Nov 2020 19:22:20 -0500 Subject: [PATCH] Fixes Issue with Trailing Slash --- CHANGELOG.md | 2 ++ .../MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64b7fad18..6b41a94f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- SPAlternateUrl + - Fixed issue where trailing '/' cause Url not to be recognized. - SPFarm - Switched from creating a Lock database to a Lock table in the TempDB. This to allow the use of precreated databases. diff --git a/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 b/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 index 946b8d81f..ec48787a7 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 @@ -168,6 +168,13 @@ function Set-TargetResource $aamForUrl = $webAppAams | Where-Object -FilterScript { $_.IncomingUrl -eq $params.Url } + if ($null -eq $aamForUrl -and $params.Url.ToString().EndsWith('/')) + { + $urlToFind = $params.Url.Remove($params.Url.Length - 1, 1) + $aamForUrl = $webAppAams | Where-Object -FilterScript { + $_.IncomingUrl -eq $urlToFind + } + } if ($null -eq $aamForUrl) {