Defect #32529

The end of the URL is replaced with "undefined" in IE11 and Edge

Added by Yuichi HARADA about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution:Fixed Affected version:

Description

Clicking "Administration > Users > [dlopper]" redirects to "/users/3/edit", however address bar shows "/users/3/undefined".

Reproduce with trunk and 4.1-stable. (Does not reproduce with 4.0-stable)

Maybe this.href added to #3058 doesn't seem to work on IE11 and Edge.
I confirmed that the following patch works with IE11, Edge, Firefox, Chrome, Safari.

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ab4849957..1ad81b216 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -452,7 +452,7 @@ module ApplicationHelper
     if tab[:onclick]
       return tab[:onclick]
     elsif tab[:partial]
-      return "showTab('#{tab[:name]}', this.href)" 
+      return "showTab('#{tab[:name]}', location.href)" 
     else
       return nil
     end
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 2ea81d566..3d2a0041b 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -615,9 +615,9 @@ module IssuesHelper
       journals_without_notes = @journals.select{|value| value.notes.blank?}
       journals_with_notes = @journals.reject{|value| value.notes.blank?}

-      tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", this.href)', :partial => 'issues/tabs/history', :locals => {:issue => @issue, :journals => @journals}}
-      tabs << {:name => 'notes', :label => :label_issue_history_notes, :onclick => 'showIssueHistory("notes", this.href)'} if journals_with_notes.any?
-      tabs << {:name => 'properties', :label => :label_issue_history_properties, :onclick => 'showIssueHistory("properties", this.href)'} if journals_without_notes.any?
+      tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", location.href)', :partial => 'issues/tabs/history', :locals => {:issue => @issue, :journals => @journals}}
+      tabs << {:name => 'notes', :label => :label_issue_history_notes, :onclick => 'showIssueHistory("notes", location.href)'} if journals_with_notes.any?
+      tabs << {:name => 'properties', :label => :label_issue_history_properties, :onclick => 'showIssueHistory("properties", location.href)'} if journals_without_notes.any?
     end
     tabs << {:name => 'time_entries', :label => :label_time_entry_plural, :remote => true, :onclick => "getRemoteTab('time_entries', '#{tab_issue_path(@issue, :name => 'time_entries')}', '#{issue_path(@issue, :tab => 'time_entries')}')"} if User.current.allowed_to?(:view_time_entries, @project) && @issue.spent_hours > 0
     tabs << {:name => 'changesets', :label => :label_associated_revisions, :remote => true, :onclick => "getRemoteTab('changesets', '#{tab_issue_path(@issue, :name => 'changesets')}', '#{issue_path(@issue, :tab => 'changesets')}')"} if @has_changesets

url_changed_to_undefined.png (39 KB) Yuichi HARADA, 2019-11-29 04:03


Related issues

Related to Redmine - Feature #3058: Show issue history using tabs Closed 2009-03-26

Associated revisions

Revision 19347
Added by Jean-Philippe Lang about 1 month ago

Fixed that URL is replaced with "undefined" in IE11 and Edge (#32529).

Patch by Marius BALTEANU.

Revision 19348
Added by Jean-Philippe Lang about 1 month ago

Merged r19347 to 4.1-stable (#32529).

History

#1 Updated by Go MAEDA about 1 month ago

#2 Updated by Go MAEDA about 1 month ago

  • Assignee set to Marius BALTEANU

Marius, could you review this fix?

#3 Updated by Marius BALTEANU about 1 month ago

Go MAEDA wrote:

Marius, could you review this fix?

Yea, I’ll do it as soon I can.

#4 Updated by Marius BALTEANU about 1 month ago

  • Assignee changed from Marius BALTEANU to Go MAEDA

Sorry for my late reply, please apply the below fix for now:

mariusbalteanu@Mariuss-MacBook-Pro redmine % git diff  
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index e125e68b4..e4e902d9c 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -412,7 +412,7 @@ function getRemoteTab(name, remote_url, url, load_always) {
 //replaces current URL with the "href" attribute of the current link
 //(only triggered if supported by browser)
 function replaceInHistory(url) {
-  if ("replaceState" in window.history) {
+  if ("replaceState" in window.history && url !== undefined) {
     window.history.replaceState(null, document.title, url);
   }
 }

#5 Updated by Yuichi HARADA about 1 month ago

Marius BALTEANU wrote:

Sorry for my late reply, please apply the below fix for now:

[...]

Marius, I confirmed that "undefined" is not displayed using IE11 and Edge. Thank you for fixing the issue.

#6 Updated by Jean-Philippe Lang about 1 month ago

  • Status changed from New to Closed
  • Assignee deleted (Go MAEDA)
  • Resolution set to Fixed

Committed, thanks.

Also available in: Atom PDF