Skip to content

Commit 6663614

Browse files
NinoFlorisKrzysztof-Cieslak
authored andcommitted
Add protection against subcontroller routes that don't start with a forward slash, which lead to unwanted behavior
1 parent 5daefb9 commit 6663614

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Saturn/Controller.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ module Controller =
277277
if keyFormat.IsSome then
278278
let stringConvert = stringConvert.Value
279279
for (sPath, sCs) in state.SubControllers do
280+
if not (sPath.StartsWith("/")) then
281+
failwith (sprintf "Subcontroller route '%s' is not valid, these routes should start with a '/'." sPath)
282+
280283
let path = keyFormat.Value
281284
let dummy = sCs (unbox<'Key> Unchecked.defaultof<'Key>)
282285
siteMap.Forward (path + sPath) "" dummy

0 commit comments

Comments
 (0)