Project

General

Profile

Actions

Defect #38464

closed

Rendering a custom field with a URL pattern set and containing " :" in the value raises Addressable::URI::InvalidURIError

Added by Thomas Löber over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Custom fields
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

An Addressable::URI::InvalidURIError occurs in Issues#show for certain values used to format a URL.

Steps to reproduce:

  1. Create an issue custom field:
  1. Inside an issue:
    • Set the custom field value to: Test :Test, i.e. Test, blank, colon, Test
    • Save the issue
  1. When the issue is about to be shown, an Addressable::URI::InvalidURIError occurs.

The error is caused by the url_from_pattern method in lib/redmine/field_format.rb. The issue can be solved by replacing the 5 occurrances of Addressable::URI.encode with URI.encode_www_form_component.

>> Addressable::URI.encode "Test :Test" 
Traceback (most recent call last):
Addressable::URI::InvalidURIError (Invalid scheme format: 'Test ')

>> URI.encode_www_form_component "Test :Test" 
=> "Test+%3ATest" 

Best regards,
Thomas


Files

38464.patch (2.81 KB) 38464.patch Go MAEDA, 2023-04-20 12:16

Related issues

Related to Redmine - Defect #32752: Ruby 2.7: Remove deprecated URI.escape/unescapeClosedGo MAEDA

Actions
Has duplicate Redmine - Defect #38491: Invalid scheme format: ' VP1'Closed

Actions
Actions

Also available in: Atom PDF