mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-11 10:26:57 +02:00
Use Uri.EscapeDataString
in a few others places
This commit is contained in:
parent
6f877cf543
commit
fca6729ef0
1 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace DiscordChatExporter.Core.Utils;
|
namespace DiscordChatExporter.Core.Utils;
|
||||||
|
@ -25,8 +24,8 @@ public class UrlBuilder
|
||||||
if (ignoreUnsetValue && string.IsNullOrWhiteSpace(value))
|
if (ignoreUnsetValue && string.IsNullOrWhiteSpace(value))
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
var keyEncoded = WebUtility.UrlEncode(key);
|
var keyEncoded = Uri.EscapeDataString(key);
|
||||||
var valueEncoded = WebUtility.UrlEncode(value);
|
var valueEncoded = Uri.EscapeDataString(value);
|
||||||
_queryParameters[keyEncoded] = valueEncoded;
|
_queryParameters[keyEncoded] = valueEncoded;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -39,9 +38,11 @@ public class UrlBuilder
|
||||||
buffer.Append(_path);
|
buffer.Append(_path);
|
||||||
|
|
||||||
if (_queryParameters.Any())
|
if (_queryParameters.Any())
|
||||||
|
{
|
||||||
buffer
|
buffer
|
||||||
.Append('?')
|
.Append('?')
|
||||||
.AppendJoin('&', _queryParameters.Select(kvp => $"{kvp.Key}={kvp.Value}"));
|
.AppendJoin('&', _queryParameters.Select(kvp => $"{kvp.Key}={kvp.Value}"));
|
||||||
|
}
|
||||||
|
|
||||||
return buffer.ToString();
|
return buffer.ToString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue