Skip to content

Commit 567ed0c

Browse files
authored
Merge pull request #643 from lepathie/bugfix/#625_unsupported_protocols_open_in_browser
Bugfix for #625: The HtmlViewer opens `.url`s with unsupported protocols in internal browser.
2 parents de10550 + 25e6d6b commit 567ed0c

File tree

1 file changed

+4
-3
lines changed
  • QuickLook.Plugin/QuickLook.Plugin.HtmlViewer

1 file changed

+4
-3
lines changed

QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2017 Paddy Xu
1+
// Copyright © 2017 Paddy Xu
22
//
33
// This file is part of QuickLook program.
44
//
@@ -26,7 +26,8 @@ namespace QuickLook.Plugin.HtmlViewer
2626
{
2727
public class Plugin : IViewer
2828
{
29-
private static readonly string[] Extensions = { ".mht", ".mhtml", ".htm", ".html", ".url" };
29+
private static readonly string[] Extensions = { ".mht", ".mhtml", ".htm", ".html" };
30+
private static readonly string[] SupportedProtocols = { "http", "https" };
3031

3132
private WebpagePanel _panel;
3233

@@ -39,7 +40,7 @@ public void Init()
3940

4041
public bool CanHandle(string path)
4142
{
42-
return !Directory.Exists(path) && Extensions.Any(path.ToLower().EndsWith);
43+
return !Directory.Exists(path) && (Extensions.Any(path.ToLower().EndsWith) || (path.ToLower().EndsWith(".url") && SupportedProtocols.Contains(Helper.GetUrlPath(path).Split(':')[0].ToLower())));
4344
}
4445

4546
public void Prepare(string path, ContextObject context)

0 commit comments

Comments
 (0)