Opened 14 years ago

Closed 14 years ago

#699 closed defect (fixed)

Xinha automatically converts date to ip link

Reported by: maco Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version:
Severity: normal Keywords:
Cc:

Description

If you simply write date in Czech format i.e. "22.11.2005", Xinha it automatically converts into the ip anchor <a href="http://22.11.2005">22.11.2005</a> which is bug. Xinha should determine ip like number X.X.X.X where X=0-255.

Change History (8)

comment:1 Changed 14 years ago by ray

Which browser? I can't reproduce this behaviour.

comment:2 Changed 14 years ago by maco

comment:3 Changed 14 years ago by gocher

In Firefox, if you write for example "10.12.2005" and then the spacebar,
then you get "<a href="http://10.10.2005">10.10.2005</a>"

comment:4 Changed 14 years ago by gocher

htmlarea.js: line 3820

change:

            var m = matchData.match(HTMLArea.RE_url);
            if(m)
            { 
              var leftText  = s.anchorNode;
              var rightText = leftText.splitText(s.anchorOffset);
              var midText   = leftText.splitText(midStart);
              autoWrap(midText, 'a').href = (m[1] ? m[1] : 'http://') + m[2];
              break;
            }

to

            RE_date = /[0-9\.]*/;
            RE_ip = /(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/;
            var m = matchData.match(HTMLArea.RE_url);
            if(m)
            { 
              if (RE_date.test(matchData)){
                if (!RE_ip.test(matchData)) {
                  break;
                }
              }
              var leftText  = s.anchorNode;
              var rightText = leftText.splitText(s.anchorOffset);
              var midText   = leftText.splitText(midStart);
              autoWrap(midText, 'a').href = (m[1] ? m[1] : 'http://') + m[2];
              break;
            }

this fixes this problem

comment:5 Changed 14 years ago by gocher

a little bit shorter regexpr

            RE_ip = /(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/;

comment:6 Changed 14 years ago by maco

now it is
htmlarea.js: line 4553

change:

            var mUrl = matchData.match(HTMLArea.RE_url);
            if ( mUrl )
            {
              var leftTextUrl  = s.anchorNode;
              var rightTextUrl = leftTextUrl.splitText(s.anchorOffset);
              var midTextUrl   = leftTextUrl.splitText(midStart);
              autoWrap(midTextUrl, 'a').href = (mUrl[1] ? mUrl[1] : 'http://') + mUrl[2];
              break;
            }

comment:7 Changed 14 years ago by gocher

ok now this fixes the problem

            RE_date = /[0-9\.]*/;
            RE_ip = /(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/;
            var mUrl = matchData.match(HTMLArea.RE_url);
            if ( mUrl )
            {
              if (RE_date.test(matchData)){
                if (!RE_ip.test(matchData)) {
                  break;
                }
              }
              var leftTextUrl  = s.anchorNode;
              var rightTextUrl = leftTextUrl.splitText(s.anchorOffset);
              var midTextUrl   = leftTextUrl.splitText(midStart);
              autoWrap(midTextUrl, 'a').href = (mUrl[1] ? mUrl[1] : 'http://') + mUrl[2];
              break;
            }

comment:8 Changed 14 years ago by gocher

  • Resolution set to fixed
  • Status changed from new to closed

Changeset 484

Note: See TracTickets for help on using tickets.