From 82c55face6acddaf54425c2d166fe52577853c7c Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Sun, 4 Feb 2018 19:11:21 +0100 Subject: [PATCH] impoved regex for apple-icons --- src/Widgets/Views/Editor.vala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Widgets/Views/Editor.vala b/src/Widgets/Views/Editor.vala index 8f77b2f..eb70060 100644 --- a/src/Widgets/Views/Editor.vala +++ b/src/Widgets/Views/Editor.vala @@ -234,13 +234,13 @@ namespace Webpin.Widgets.Views { } } - regex = new Regex ("(?<=\"apple-touch-icon\" href=\")[/\\w\\.]*"); + regex = new Regex ("(\"apple-touch-icon\").*href=\"([\\-/\\w]*.png)"); if (regex.match (body, 0, out match_info)) { - var result = match_info.fetch (0); + var result = match_info.fetch (match_info.get_match_count () - 1); var icon_path = result; - if (!result.has_prefix ("http")) { - result = Path.build_filename (url, result); + if (!icon_path.has_prefix ("http")) { + icon_path = Path.build_filename (url, result); } download_icon (icon_path); icon_name_entry.set_text (tmp_icon_file);