Only URL encode input and filename

This commit is contained in:
Jaex 2018-11-24 22:52:06 +03:00
parent 3d3eaa2c64
commit 25bf2c4297

View file

@ -126,11 +126,7 @@ public string Parse(string text, bool isOutput)
if (!string.IsNullOrEmpty(syntaxResult))
{
if (URLEncode)
{
syntaxResult = URLHelpers.URLEncode(syntaxResult);
}
else if (JSONEncode)
if (JSONEncode)
{
syntaxResult = URLHelpers.JSONEncode(syntaxResult);
}
@ -205,13 +201,13 @@ private string ParseSyntax(string syntax, bool isOutput)
{
if (CheckKeyword(syntax, "input")) // Example: $input$
{
return Input;
return AutoEncode(Input);
}
}
if (CheckKeyword(syntax, "filename")) // Example: $filename$
{
return Filename;
return AutoEncode(Filename);
}
else if (CheckKeyword(syntax, "random", out value)) // Example: $random:domain1.com|domain2.com$
{
@ -234,6 +230,16 @@ private string ParseSyntax(string syntax, bool isOutput)
return null;
}
private string AutoEncode(string text)
{
if (URLEncode)
{
return URLHelpers.URLEncode(text);
}
return text;
}
private bool CheckKeyword(string syntax, string keyword)
{
return CheckKeyword(syntax, keyword, out _);