Skip to content

Commit 4043025

Browse files
author
Luca Sonntag
committed
Normalize allowed origins
1 parent be83917 commit 4043025

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

CefSharp/JavascriptBinding/JavascriptBindingSettings.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System.Collections.Generic;
66
using CefSharp.Internals;
7+
using System;
78

89
namespace CefSharp.JavascriptBinding
910
{
@@ -48,8 +49,17 @@ public string[] JavascriptBindingApiAllowOrigins
4849
set
4950
{
5051
ThrowIfFrozen();
51-
52-
javascriptBindingApiAllowOrigins = value;
52+
if (value != null)
53+
{
54+
javascriptBindingApiAllowOrigins = Array.ConvertAll(
55+
value,
56+
origin => origin.EndsWith("/") ? origin.Substring(0, origin.Length - 1) : origin
57+
);
58+
}
59+
else
60+
{
61+
javascriptBindingApiAllowOrigins = null;
62+
}
5363
}
5464
}
5565

0 commit comments

Comments
 (0)