Opened 8 years ago

Closed 8 years ago

#1337 closed defect (fixed)

GetHTML truncates hyperlinks

Reported by: guest Owned by:
Priority: normal Milestone: 0.96
Component: HTML Output Version: trunk
Severity: blocker Keywords: GetHtml
Cc:

Description

When making a link like the following it get's truncated whith GetHTML plugin:

<a href="http://www.domain.com/Coupon-$30-Value/index.html">mattis</a>

becomes

<a href="http://www.domain.com/Coupon-http://www.domain.com/Coupon-$30-Value/index.html0-Value/index.html">mattis</a>

Change History (1)

comment:1 Changed 8 years ago by nicholasbs

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

Changeset r1129 fixes this bug. The issue was that replace() was interpreting the "$3" in the URL above as a reference to the third captured group and replacing it accordingly. I added a function _escapeDollars() that takes a string and replaces each $ with $$.

I've tested this and it seems to be working perfectly. However, I'm nervous any time code like this that gets run so frequently and in so many different contexts gets fiddled with. I'd propose two things:

1) This GetHtml code (specifically the code in TransformInnerHTML.js) is a string of dozens of nested replace calls and nasty regexes. It'd probably be a good idea to clean this up at some point in the future.

2) Code like this practically screams for unit tests. I think a goal for after the next release should be to create some tests so that we can be more confident that we aren't introducing new bugs or reopening old ones.

Note: See TracTickets for help on using tickets.