]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/img.pm
minor problem
[git.ikiwiki.info.git] / IkiWiki / Plugin / img.pm
index 68b001671653000b4907ababf1d63782d834381c..5f97e38108ad22cfb9cde8dd9500d298201752be 100644 (file)
@@ -135,11 +135,15 @@ sub preprocess (@) {
        elsif ($params{link} =~ /^\w+:\/\//) {
                $imgtag='<a href="'.$params{link}.'">'.$imgtag.'</a>';
        }
-       elsif (length bestlink($params{page}, $params{link})) {
-               add_depends($params{page}, $params{link});
-               $imgtag=htmllink($params{page}, $params{destpage},
-                       $params{link}, linktext => $imgtag,
-                       noimageinline => 1);
+       else {
+               my $b = bestlink($params{page}, $params{link});
+       
+               if (length $b) {
+                       add_depends($params{page}, $b);
+                       $imgtag=htmllink($params{page}, $params{destpage},
+                               $params{link}, linktext => $imgtag,
+                               noimageinline => 1);
+               }
        }
 
        if (exists $params{caption}) {