mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-29 21:39:34 +02:00
Modern HTTP Client (#685)
This commit is contained in:
@@ -210,5 +210,26 @@ namespace NzbDrone.Common.Extensions
|
||||
|
||||
return result.TrimStart(' ', '.').TrimEnd(' ');
|
||||
}
|
||||
|
||||
public static string EncodeRFC3986(this string value)
|
||||
{
|
||||
// From Twitterizer http://www.twitterizer.net/
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var encoded = Uri.EscapeDataString(value);
|
||||
|
||||
return Regex
|
||||
.Replace(encoded, "(%[0-9a-f][0-9a-f])", c => c.Value.ToUpper())
|
||||
.Replace("(", "%28")
|
||||
.Replace(")", "%29")
|
||||
.Replace("$", "%24")
|
||||
.Replace("!", "%21")
|
||||
.Replace("*", "%2A")
|
||||
.Replace("'", "%27")
|
||||
.Replace("%7E", "~");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user