Add handling of not finding version to download and add ElvUI hacks where the HTML module fails to parse the whole document.

This commit is contained in:
2020-01-19 17:12:14 +01:00
parent a202486679
commit b3e5b7ba86

View File

@ -242,7 +242,7 @@ sub find_in_html {
if(defined($html)) {
my @file = split(/\n/, $html);
foreach my $line(@file) {
if($line =~ m/$sstring/) {
if($line =~ m/$sstring/) {
my $parsed = $parser->parse_balanced_chunk($line);
my @nodes = $parsed->nonBlankChildNodes();
foreach my $node(@nodes) {
@ -251,7 +251,12 @@ sub find_in_html {
my $href = $node->getAttribute('href');
$retstr = (split(/$sstring/, $href,2))[1];
} elsif($mode eq 'vstring') {
$retstr = $node->getAttribute('data-name');
if($sstring =~ m/downloads/) { #ElvUI hacks
$retstr = $node->getAttribute('href');
$retstr =~ s/$sstring//g;
} else {
$retstr = $node->getAttribute('data-name');
}
}
return $retstr if($retstr);
}
@ -328,6 +333,8 @@ sub init_pool {
$addon->{'targetversion'} = $version;
return { retval => 1, did => 'check', addon => $addon };
}
} elsif (! defined($version)) {
return { retval => 0, did => 'check', result => 'Could not find version number', addon => $addon };
} else {
return { retval => 0, did => 'check', result => 'No need to update', addon => $addon };
}