Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#9558 closed defect (fixed)

[Patch] Keywords containing single quotes break autocomplete

Reported by: rjollos Owned by: rjollos
Priority: normal Component: KeywordSuggestPlugin
Severity: normal Keywords:
Cc: itamarost, hasienda Trac Release: 0.11

Description (last modified by rjollos)

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 itamarost 3 years ago.
fix single-quote issue

Download all attachments as: .zip

Change History (10)

comment:1 Changed 3 years ago by rjollos

  • Owner changed from scratcher to rjollos

comment:2 Changed 3 years ago by rjollos

  • Description modified (diff)

comment:3 Changed 3 years ago by rjollos

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 3 years ago by itamarost

fix single-quote issue

comment:4 follow-ups: Changed 3 years ago by itamarost

  • Summary changed from Trac 0.12 support to [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 3 years ago by rjollos

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

comment:6 in reply to: ↑ 4 Changed 3 years ago by rjollos

  • Status changed from new to assigned

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 ; follow-up: Changed 3 years ago by rjollos

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 3 years ago by rjollos

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

(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 3 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.

Add Comment

Modify Ticket

Action
as closed The owner will remain rjollos.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.