You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2023/08/03 09:43:08 UTC

svn commit: r1911421 - /spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm

Author: hege
Date: Thu Aug  3 09:43:08 2023
New Revision: 1911421

URL: http://svn.apache.org/viewvc?rev=1911421&view=rev
Log:
Bug 8152 - base href not handled properly

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm?rev=1911421&r1=1911420&r2=1911421&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm Thu Aug  3 09:43:08 2023
@@ -349,12 +349,17 @@ sub push_uri {
   my ($self, $type, $uri) = @_;
 
   $uri = $self->canon_uri($uri);
+  return if $uri eq '';
   utf8::encode($uri) if $self->{SA_encode_results};
 
-  my $target = target_uri($self->{base_href} || "", $uri);
-
-  # skip things like <iframe src="" ...>
-  $self->{uri}->{$uri}->{types}->{$type} = 1  if $uri ne '';
+  if ($uri =~ /^(?:data|mailto|file|cid|tel):/i) {
+    # No target handling required
+    $self->{uri}->{$uri}->{types}->{$type} = 1;
+  } else {
+    my $target = target_uri($self->{base_href} || "", $uri);
+    # skip things like <iframe src="" ...>
+    $self->{uri}->{$target}->{types}->{$type} = 1  if $target ne '';
+  }
 }
 
 sub canon_uri {
@@ -1255,7 +1260,7 @@ sub target_uri {
       $result .= "ftp:";
     }
   }
-  if ($t{authority}) {
+  if (defined $t{authority}) {
     $result .= "//" . $t{authority};
   }
   $result .= $t{path};