Delivery API: Ensure the path parameter starts with forward slash (#14428)

* Ensure path starts with forward slash in all cases

* Fix path in preview when getting by route

* Reintroduce path.length check

* Revert previous changes
This commit is contained in:
Elitsa Marinovska
2023-06-23 11:22:13 +02:00
committed by GitHub
parent 0f0c256beb
commit 115e79113e

View File

@@ -58,7 +58,8 @@ public class ByRouteContentApiController : ContentApiItemControllerBase
path = WebUtility.UrlDecode(path);
}
path = path.EnsureStartsWith("/");
path = path.TrimStart("/");
path = path.Length == 0 ? "/" : path;
IPublishedContent? contentItem = GetContent(path);
if (contentItem is not null)