mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use URI class to detect web URL
This commit is contained in:
parent
b5c212504a
commit
d62d710878
2 changed files with 8 additions and 2 deletions
|
|
@ -114,7 +114,10 @@ namespace Flow.Launcher.Infrastructure.Image
|
||||||
{
|
{
|
||||||
return new ImageResult(ImageCache[path], ImageType.Cache);
|
return new ImageResult(ImageCache[path], ImageType.Cache);
|
||||||
}
|
}
|
||||||
if (path.StartsWith("http://") || path.StartsWith("https://"))
|
Uri uriResult;
|
||||||
|
bool IsUriScheme = Uri.TryCreate(path, UriKind.Absolute, out uriResult)
|
||||||
|
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
|
||||||
|
if (IsUriScheme)
|
||||||
{
|
{
|
||||||
// Download image from url
|
// Download image from url
|
||||||
using (WebClient client = new WebClient())
|
using (WebClient client = new WebClient())
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,11 @@ namespace Flow.Launcher.Plugin
|
||||||
get { return _pluginDirectory; }
|
get { return _pluginDirectory; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
Uri uriResult;
|
||||||
|
bool IsUriScheme = Uri.TryCreate(IcoPath, UriKind.Absolute, out uriResult)
|
||||||
|
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
|
||||||
_pluginDirectory = value;
|
_pluginDirectory = value;
|
||||||
if (!string.IsNullOrEmpty(IcoPath) && !Path.IsPathRooted(IcoPath) && !IcoPath.StartsWith("http://") && !IcoPath.StartsWith("https://"))
|
if (!string.IsNullOrEmpty(IcoPath) && !Path.IsPathRooted(IcoPath) && !IsUriScheme)
|
||||||
{
|
{
|
||||||
IcoPath = Path.Combine(value, IcoPath);
|
IcoPath = Path.Combine(value, IcoPath);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue