mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
If there is no value in query string then don't add = after key
This commit is contained in:
parent
b238357bcc
commit
014fd671f1
1 changed files with 30 additions and 1 deletions
|
@ -444,7 +444,36 @@ public static string CreateQueryString(Dictionary<string, string> args, bool cus
|
|||
{
|
||||
if (args != null && args.Count > 0)
|
||||
{
|
||||
return string.Join("&", args.Select(x => x.Key + "=" + (customEncoding ? URLEncode(x.Value) : HttpUtility.UrlEncode(x.Value))).ToArray());
|
||||
List<string> pairs = new List<string>();
|
||||
|
||||
foreach (KeyValuePair<string, string> arg in args)
|
||||
{
|
||||
string pair;
|
||||
|
||||
if (string.IsNullOrEmpty(arg.Value))
|
||||
{
|
||||
pair = arg.Key;
|
||||
}
|
||||
else
|
||||
{
|
||||
string value;
|
||||
|
||||
if (customEncoding)
|
||||
{
|
||||
value = URLEncode(arg.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = HttpUtility.UrlEncode(arg.Value);
|
||||
}
|
||||
|
||||
pair = arg.Key + "=" + value;
|
||||
}
|
||||
|
||||
pairs.Add(pair);
|
||||
}
|
||||
|
||||
return string.Join("&", pairs);
|
||||
}
|
||||
|
||||
return "";
|
||||
|
|
Loading…
Reference in a new issue