Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13036 closed defect (cantfix)

TracDragDropPlugin: Did't work with error 'TypeError: str.replace is not a function trac.js:237:1'

Reported by: komar Owned by: Jun Omae
Priority: normal Component: TracDragDropPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description

I got error in js

TypeError: str.replace is not a function trac.js:237:1
format() trac.js:237
$.format() trac.js:250
<anonymous> jquery-ui-i18n.js:21
s.Callbacks/d() jquery.js:2
s.Callbacks/v.fireWith() jquery.js:2
s</<.ready() jquery.js:2
s</k() jquery.js:2

And dragdrop pluging did't work in my firefox 45.5 and uzbl. If I click 'Attach' I get new page. No 'You may use drag and drop here.' showed.

If I fix trac.js with this patch

--- /tmp/trac.js.orig   2017-01-09 15:47:02.310633616 +0000
+++ /var/www/default/htdocs/common/js/trac.js   2017-01-09 16:45:26.166843708 +0000
@@ -234,7 +234,7 @@
 
   function format(str, args, escape) {
     var kwargs = args[args.length - 1];
-    return str.replace(/\${?(\w+)}?/g, function(_, k) {
+    return str.toString().replace(/\${?(\w+)}?/g, function(_, k) {
       var result;
       if (k.length == 1 && k >= '0' && k <= '9')
         result = args[k - '0'];

everything working fine.

I'm not familiar with js and jquery, so I did't know how to fix this in TracDragDropPlugin :/

Attachments (0)

Change History (6)

comment:1 Changed 8 years ago by Jun Omae

Resolution: cantfix
Status: newclosed

Works for me with Firefox 50.1.0. Also, what's uzbl? If you encounter the issue without uzbl, reopen it.

comment:2 Changed 8 years ago by Jun Omae

tracdragdrop/htdocs/tracdragdrop.js doesn't use $.format(). That is not a TracDragDropPlugin issue.

comment:3 Changed 8 years ago by Jun Omae

Summary: [patch] TracDragDropPlugin: Did't work with error 'TypeError: str.replace is not a function trac.js:237:1'TracDragDropPlugin: Did't work with error 'TypeError: str.replace is not a function trac.js:237:1'

comment:4 Changed 8 years ago by komar

That wonder me also. I'm install TracDragDropPlugin, it's did't work neither in firefox nor in uzbl. I just check out js warnings, find this one, and fix it. After this fix everything work and in firefox and in uzbl.

I can't see direct connection with this fix and TracDragDropPlugin. Traceback in ticket description show some callback calling with i18n, can be there problem?

comment:5 Changed 8 years ago by Jun Omae

Trac Release: 1.2

No traceback and no errors for me.

I consider your environment has issues about installation. Please post System Information and Installed Plugins in about page of your Trac.

comment:6 Changed 8 years ago by Jun Omae

The issue is raised from line 21 in jquery-ui-i18n.js:

  4   var formatMonth = _("$month$year");
...
 21     yearSuffix: $.format(formatMonth, {month: '', year: ''}),

However TracDragDropPlugin doesn't require jquery-ui. I guess other plugin(s) require jquery-ui and lead this issue.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.