Project

General

Profile

Actions

Bug #13521

closed

WT-13501 breaks WTemplate internal path encoding

Added by Steven Köhler 9 days ago. Updated 4 days ago.

Status:
Closed
Priority:
High
Target version:
Start date:
02/13/2025
Due date:
% Done:

100%

Estimated time:

Description

While trying the latest updates I discovered that WT-13501, namely Commit 05e4064, introduces a breaking bug with WTemplate internal path encoding. Having an <a> tag inside a condition block, like ${<cond>}<a href="#/target">link</a>${</cond>}, will lead to a javascript exception if internal path encoding is enabled and the condition is set to false.

I could trace the issue to the changes in RefEncoder.c. Despite the <a> tag not being included in the (rendered) template text due to the false condition, the newly introduced javascript will be created and executed regardlessly - but will not find an element with the dummy id and thus result in the aforementioned javascript exception. Interestingly this issue does not always seem to occur on inital page loading. It does occur though, if the WTemplate is added later in an event.

I created and added a minimal working example. Just start it up in an ajax enabled session, click the button and enjoy! :)


Files

err-13501.png (4.38 KB) err-13501.png Steven Köhler, 02/13/2025 01:06 PM
main.cpp (869 Bytes) main.cpp Steven Köhler, 02/13/2025 01:35 PM
Actions #1

Updated by Matthias Van Ceulebroeck 9 days ago

  • Status changed from New to InProgress
  • Assignee set to Matthias Van Ceulebroeck
  • Target version set to 4.11.3

Hey Steven,

thank you for the report, it's much appreciated.
While the original was thoroughly tested, it does seem like I missed this case.

Indeed, when rendering a page out initially, or when content is added later on, this will result in different behavior. Since on the initial request we cannot rely on the Wt framework being present already.

Actions #2

Updated by Matthias Van Ceulebroeck 8 days ago

  • Status changed from InProgress to Review
  • Assignee deleted (Matthias Van Ceulebroeck)
Actions #3

Updated by Romain Mardulyn 5 days ago

  • Assignee set to Romain Mardulyn
Actions #4

Updated by Romain Mardulyn 4 days ago

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Romain Mardulyn to Matthias Van Ceulebroeck
Actions #5

Updated by Matthias Van Ceulebroeck 4 days ago

  • % Done changed from 0 to 100
Actions #6

Updated by Matthias Van Ceulebroeck 4 days ago

  • Status changed from Implemented @Emweb to Implemented @Test
Actions #7

Updated by Matthias Van Ceulebroeck 4 days ago

  • Status changed from Implemented @Test to Closed
Actions

Also available in: Atom PDF