mirror of
https://github.com/C9Glax/tranga.git
synced 2025-01-12 19:37:33 +01:00
LibraryConnector baseUrl regex
This commit is contained in:
parent
48d312da0b
commit
4f4b0cb3a8
@ -1,5 +1,6 @@
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Logging;
|
using Logging;
|
||||||
|
|
||||||
namespace Tranga.LibraryConnectors;
|
namespace Tranga.LibraryConnectors;
|
||||||
@ -20,7 +21,10 @@ public abstract class LibraryConnector : GlobalBase
|
|||||||
|
|
||||||
protected LibraryConnector(GlobalBase clone, string baseUrl, string auth, LibraryType libraryType) : base(clone)
|
protected LibraryConnector(GlobalBase clone, string baseUrl, string auth, LibraryType libraryType) : base(clone)
|
||||||
{
|
{
|
||||||
this.baseUrl = baseUrl;
|
Regex urlRex = new(@"https?:\/\/[0-9A-z\.]*");
|
||||||
|
if (!urlRex.IsMatch(baseUrl))
|
||||||
|
throw new ArgumentException("Base url does not match pattern");
|
||||||
|
this.baseUrl = urlRex.Match(baseUrl).Value;
|
||||||
this.auth = auth;
|
this.auth = auth;
|
||||||
this.libraryType = libraryType;
|
this.libraryType = libraryType;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user