impoved regex for apple-icons

This commit is contained in:
Artem Anufrij 2018-02-04 19:11:21 +01:00
parent 4b776e985a
commit 82c55face6

View file

@ -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)) { 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; var icon_path = result;
if (!result.has_prefix ("http")) { if (!icon_path.has_prefix ("http")) {
result = Path.build_filename (url, result); icon_path = Path.build_filename (url, result);
} }
download_icon (icon_path); download_icon (icon_path);
icon_name_entry.set_text (tmp_icon_file); icon_name_entry.set_text (tmp_icon_file);