Project

General

Profile

Actions

Defect #3692

open

URL-generation is brittle with trailing slashes

Added by Wolfgang Schnerring over 14 years ago. Updated almost 14 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Email notifications
Target version:
-
Start date:
2009-07-29
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

When the setting Adminstration/Settings/General/"Hostname and path" has a trailing slash (e. g. "http://example.com/redmine/", the links in the "issue updated" emails contain duplicate slashes (e. g. "http://example.com/redmine//repositories/revision/myproject/17") which cannot be routed and give 404 instead.

I've scrutinized the code, and the underlying reason is that url_for does not care about a trailing slash in the "host" part of the URL and simply appends the full path even if that duplicates the slash. I'm not sure whether it should do so, or if Redmine should be careful to strip any trailing slashes instead (in app/models/mailer.rb Mailer::default_url_options).

Either way, this behaviour is quite brittle and also rather non-obvious to figure out, so it would be nice if Redmine did the Right Thing(tm) regardless of trailing slashes in the "hostname" setting.


Files

mailer_trailing_slash_fix.patch (1.71 KB) mailer_trailing_slash_fix.patch Trailing-slash fix + test to cover change. Olafur Gislason, 2010-06-19 02:23
settings_hostname_trailing_slash_fix.diff (1.54 KB) settings_hostname_trailing_slash_fix.diff Settings_controller modification and additional test. Olafur Gislason, 2010-06-21 22:20
3692.patch (1.65 KB) 3692.patch Gregor Schmidt, 2010-06-21 23:11
Actions

Also available in: Atom PDF