mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-30 12:11:07 +12:00
Added URLEncodeIgnoreEmoji option to application settings advanced tab, it is currently supported in S3, GCS and FTP/FTPS/SFTP
This commit is contained in:
parent
f20fdd8002
commit
9aef43c6e4
|
@ -82,8 +82,13 @@ public static void OpenURL(string url)
|
|||
}
|
||||
}
|
||||
|
||||
public static string URLEncode(string text, bool isPath = false)
|
||||
public static string URLEncode(string text, bool isPath = false, bool ignoreEmoji = false)
|
||||
{
|
||||
if (ignoreEmoji)
|
||||
{
|
||||
return URLEncodeIgnoreEmoji(text, isPath);
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
|
|
|
@ -39,5 +39,6 @@ public static class HelpersOptions
|
|||
public static string BrowserPath { get; set; } = "";
|
||||
public static List<Color> RecentColors { get; set; } = new List<Color>();
|
||||
public static string LastSaveDirectory { get; set; } = "";
|
||||
public static bool URLEncodeIgnoreEmoji { get; set; } = false;
|
||||
}
|
||||
}
|
|
@ -263,7 +263,7 @@ public string GenerateURL(string uploadPath)
|
|||
{
|
||||
if (!string.IsNullOrEmpty(Settings.Endpoint) && !string.IsNullOrEmpty(Settings.Bucket))
|
||||
{
|
||||
uploadPath = URLHelpers.URLEncodeIgnoreEmoji(uploadPath, true);
|
||||
uploadPath = URLHelpers.URLEncode(uploadPath, true, HelpersOptions.URLEncodeIgnoreEmoji);
|
||||
|
||||
string url;
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ public string GetUriPath(string filename, string subFolderPath = null)
|
|||
filename = Path.GetFileNameWithoutExtension(filename);
|
||||
}
|
||||
|
||||
filename = URLHelpers.URLEncode(filename);
|
||||
filename = URLHelpers.URLEncode(filename, false, HelpersOptions.URLEncodeIgnoreEmoji);
|
||||
|
||||
if (subFolderPath == null)
|
||||
{
|
||||
|
|
|
@ -164,7 +164,7 @@ public string GenerateURL(string uploadPath)
|
|||
Domain = URLHelpers.CombineURL("storage.googleapis.com", Bucket);
|
||||
}
|
||||
|
||||
uploadPath = URLHelpers.URLEncode(uploadPath, true);
|
||||
uploadPath = URLHelpers.URLEncode(uploadPath, true, HelpersOptions.URLEncodeIgnoreEmoji);
|
||||
|
||||
string url = URLHelpers.CombineURL(Domain, uploadPath);
|
||||
|
||||
|
|
|
@ -223,6 +223,9 @@ public int HotkeyRepeatLimit
|
|||
[Category("Upload"), DefaultValue(false), Description("Accept invalid SSL certificates when uploading.")]
|
||||
public bool AcceptInvalidSSLCertificates { get; set; }
|
||||
|
||||
[Category("Upload"), DefaultValue(true), Description("Ignore emojis while URL encoding upload results.")]
|
||||
public bool URLEncodeIgnoreEmoji { get; set; }
|
||||
|
||||
[Category("Upload"), DefaultValue(true), Description("Show first time upload warning.")]
|
||||
public bool ShowUploadWarning { get; set; }
|
||||
|
||||
|
|
|
@ -930,6 +930,7 @@ private void AfterApplicationSettingsJobs()
|
|||
|
||||
HelpersOptions.CurrentProxy = Program.Settings.ProxySettings;
|
||||
HelpersOptions.AcceptInvalidSSLCertificates = Program.Settings.AcceptInvalidSSLCertificates;
|
||||
HelpersOptions.URLEncodeIgnoreEmoji = Program.Settings.URLEncodeIgnoreEmoji;
|
||||
HelpersOptions.DefaultCopyImageFillBackground = Program.Settings.DefaultClipboardCopyImageFillBackground;
|
||||
HelpersOptions.RotateImageByExifOrientationData = Program.Settings.RotateImageByExifOrientationData;
|
||||
HelpersOptions.BrowserPath = Program.Settings.BrowserPath;
|
||||
|
|
Loading…
Reference in a new issue