mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-02 13:10:22 +12:00
Only URL encode input and filename
This commit is contained in:
parent
3d3eaa2c64
commit
25bf2c4297
|
@ -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 _);
|
||||
|
|
Loading…
Reference in a new issue