Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9558 closed defect (fixed)

[Patch] Keywords containing single quotes break autocomplete

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Component: KeywordSuggestPlugin
Severity: normal Keywords:
Cc: Itamar Ostricher, Steffen Hoffmann Trac Release: 0.11

Description (last modified by Ryan J Ollos)

As originally posted by itamarost in comment:27:ticket:4201:

I ported the patch from this ticket, so it now works for me with Trac-0.12.3dev and TagsPlugin (trunk with patch from #7857).

It populates the autocomplete by merging the keywords trac.ini ListOption with all existing tags from TagsPlugin, if TagsPlugin is installed (otherwise it just uses the keywords ListOption).

The autocomplete is also available for wiki-tags when TagsPlugin is installed.

Also fixed on the way a problem with tags that contain a quote (need escaping when embedded in inline JS).

Patch is here.

Attachments (1)

keywordsuggestplugin-9558-itamaro-v1.patch (2.6 KB) - added by Itamar Ostricher 6 years ago.
fix single-quote issue

Download all attachments as: .zip

Change History (10)

comment:1 Changed 6 years ago by Ryan J Ollos

Owner: changed from scratcher to Ryan J Ollos

comment:2 Changed 6 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 6 years ago by Ryan J Ollos

itamarost: if you are able to create a patch of the 0.12 changes against the 0.4 version of the plugin that I committed in #4201, I could get the 0.12 compatibility applied fairly soon. Otherwise, I'll probably get to it in a few weeks when finishing up my own Trac 0.12 upgrade.

Changed 6 years ago by Itamar Ostricher

fix single-quote issue

comment:4 Changed 6 years ago by Itamar Ostricher

Summary: Trac 0.12 support[Patch] Keywords containing single quotes break autocomplete

I have updated to the latest trunk, with the latest trunk of TagsPlugin, and it worked just fine on my Trac-0.12.3dev.

So I decided to hijack this ticket for a fix that was in my previous patch and got left out - an issue that breaks the autocomplete when a keyword containing a single-quote exists.

In addition, I've noticed that when the TagsPlugin is not installed, this plugin still injects the javascript to wiki_edit, so I tried addressing that as well in the attached patch.

comment:5 Changed 6 years ago by Ryan J Ollos

Thanks for the new patch. I hope to get it committed to the repository tomorrow.

comment:6 in reply to:  4 Changed 6 years ago by Ryan J Ollos

Status: newassigned

Replying to itamarost:

I have updated to the latest trunk, with the latest trunk of TagsPlugin, and it worked just fine on my Trac-0.12.3dev.

Added the 0.12 tag to the KeywordSuggestPlugin page. Thanks for testing.

comment:7 in reply to:  4 ; Changed 6 years ago by Ryan J Ollos

Replying to itamarost:

So I decided to hijack this ticket for a fix that was in my previous patch and got left out - an issue that breaks the autocomplete when a keyword containing a single-quote exists.

I'm going to make a minor change to your patch and use javascript_quote from trac.util.text rather than replace. Let me know if you have any comments on this.

comment:8 Changed 6 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

(In [10960]) Fixes #9558: (0.4.3) Patch by itamarost.

  • FIX: Keyword with a single quote would break autocomplete because the string was not being correctly escaped.
  • FIX: When the TagsPlugin was not installed, javascript was still injected into the wiki edit page.

comment:9 in reply to:  7 Changed 6 years ago by anonymous

Replying to rjollos:

I'm going to make a minor change to your patch and use javascript_quote from trac.util.text rather than replace. Let me know if you have any comments on this.

Definitely a better solution. I was not aware of that util function.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.