]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Tag bug. Appears at times when using LNK tag in compination with other tags.
authorMetabox <redacted>
Sun, 28 Apr 2019 08:43:25 +0000 (18:43 +1000)
committerMetabox <redacted>
Sun, 28 Apr 2019 08:43:25 +0000 (18:43 +1000)
htdocs/cgi-bin/main.cgi

index 64cb2b45f990ac6efbacde4666ebe3ea4588a5f7..3fe53049015e779bd6b871a150cc02b31deb9b14 100755 (executable)
@@ -250,7 +250,7 @@ while(my @row = $st->fetchrow_array()) {
        }
 
   my $sub ="";
-
+  my $tagged = 0;
        #Check for LNK takes precedence here as we also parse plain placed URL's for http protocol later.
   if($log =~ /<<LNK</){
           my $idx = $-[0]+5;
@@ -258,6 +258,7 @@ while(my @row = $st->fetchrow_array()) {
           $sub = substr($log, $idx+1,$len-$idx-1);
                 my $url = qq(<a href="$sub" target=_blank>$sub</a>);
                  $tags .= qq(<input id="tag$id" type="hidden" value="$log"/>\n);
+                                $tagged = 1;
              $log=~s/<<LNK<(.*?)>/$url/osi;
   }
 
@@ -267,7 +268,9 @@ while(my @row = $st->fetchrow_array()) {
           my $len = index($log, '>', $idx);
           $sub = substr($log,$idx+1,$len-$idx-1);
           my $url = qq(<img src="$sub"/>);
+                if(!$tagged){
                  $tags .= qq(<input id="tag$id" type="hidden" value="$log"/>\n);
+                }
              $log=~s/<<IMG<(.*?)>/$url/osi;              
        }
        elsif($log =~ /<<FRM</){
@@ -290,7 +293,9 @@ while(my @row = $st->fetchrow_array()) {
                        #TODO fetch from web locally the original image.
                        $lnk = qq(\n<img src="$lnk" width="$imgw" height="$imgh" class="tag_FRM"/>);
                  }     
-                 $tags .= qq(<input id="tag$id" type="hidden" value="$log"/>\n);       
+                       if(!$tagged){
+                     $tags .= qq(<input id="tag$id" type="hidden" value="$log"/>\n);   
+                       }
            $log=~s/<<FRM<(.*?)>/$lnk/o;
        }