Defect #19791

If user using customized theme with special characters in folder name, the generated stylesheet's URL won't be valid

Added by Jethro Yu over 2 years ago. Updated over 2 years ago.

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

0%

Category:Themes
Target version:-
Resolution: Affected version:2.6.3

Description

I report this because the special case can cause error in my plugin, redmine_issue_reminder

Overview Description:

If user use folder named "circle space" in redmine for customized theme, the generated page can use:

    <link href="/themes/circle%20space/stylesheets/application.css" media="all" rel="stylesheet" type="text/css">

But not:

    <link href="/themes/circle space/stylesheets/application.css" media="all" rel="stylesheet" type="text/css">

href syntax : is it okay to have space in file name?

HTML: href syntax : is it okay to have space in file name - Stack Overflow

If user using customized theme with special characters in folder name, the generated stylesheet's URL is not valid

The href attribute should contain a valid URL1. Since space characters are not allowed2 in URLs, you have to encode them3.

The Patch

The patch only escapes String but not Symbol, so it may be not a full solution.

logs

sh: 1: svn: not found
sh: 1: darcs: not found
sh: 1: cvs: not found
sh: 1: bzr: not found
Environment:
  Redmine version                2.6.3.stable
  Ruby version                   2.0.0-p598 (2014-11-13) [x86_64-linux]
  Rails version                  3.2.21
  Environment                    production
  Database adapter               Mysql2
SCM:
  Mercurial                      2.8.2
  Git                            1.9.1
  Filesystem
Redmine plugins:
  clipboard_image_paste          1.9
  progressive_projects_list      1.0.0
  redmine_bootstrap_kit          0.1
  redmine_didyoumean             1.2.0
  redmine_graphs                 0.1.0
  redmine_image_clipboard_paste  1.0.0
  redmine_issue_reminder         3.0.0
  redmine_issue_templates        0.1.0
  redmine_keyboard_shortcuts     0.0.1
  redmine_lightbox               0.0.8
  redmine_stealth                0.6.0
  redmine_zenedit                0.0.2
  scrum                          0.9.1
  sidebar_hide                   0.0.7

1 http://en.wikipedia.org/wiki/URL#Syntax

2 http://stackoverflow.com/questions/497908/are-urls-allowed-to-have-a-space-in-them

3 http://www.w3schools.com/TAGS/ref_urlencode.asp

0001-URI-escape-stylesheet_link.patch Magnifier (1.09 KB) Jethro Yu, 2015-05-08 12:00

History

#1 Updated by Jethro Yu over 2 years ago

The problem is that Premailer uses URI to parse stylesheet file path, which errors when path has white space.

I have Monkey-Patched Premailer to use addressable/uri instead of native uri and it's fine now.

"My patch for Premailer/Premailer-rails"
However the issue still exists and currently there are no proper patch for this.

Also available in: Atom PDF