mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Don't show www. in chevereto or pomf list
This commit is contained in:
parent
2e6211648c
commit
6c6ab39cf1
3 changed files with 26 additions and 16 deletions
|
@ -350,5 +350,27 @@ public static string RemovePrefixes(string url)
|
|||
|
||||
return url;
|
||||
}
|
||||
|
||||
public static string GetShortURL(string url)
|
||||
{
|
||||
Uri uri;
|
||||
|
||||
if (Uri.TryCreate(url, UriKind.Absolute, out uri))
|
||||
{
|
||||
string host = uri.Host;
|
||||
|
||||
if (!string.IsNullOrEmpty(host))
|
||||
{
|
||||
if (host.StartsWith("www.", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
host = host.Substring(4);
|
||||
}
|
||||
|
||||
return host;
|
||||
}
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib;
|
||||
using System;
|
||||
|
||||
namespace ShareX.UploadersLib.FileUploaders
|
||||
|
@ -44,14 +45,7 @@ public PomfUploader(string uploadURL, string resultURL = null)
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
Uri uri;
|
||||
|
||||
if (Uri.TryCreate(UploadURL, UriKind.Absolute, out uri))
|
||||
{
|
||||
return uri.Host;
|
||||
}
|
||||
|
||||
return UploadURL;
|
||||
return URLHelpers.GetShortURL(UploadURL);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -47,14 +48,7 @@ public CheveretoUploader(string uploadURL, string apiKey)
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
Uri uri;
|
||||
|
||||
if (Uri.TryCreate(UploadURL, UriKind.Absolute, out uri))
|
||||
{
|
||||
return uri.Host;
|
||||
}
|
||||
|
||||
return UploadURL;
|
||||
return URLHelpers.GetShortURL(UploadURL);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue