Defect #31287

Case sensitivity for title of WikiPage under postgresql

Added by hyper loop 18 days ago. Updated 8 days ago.

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

0%

Category:-
Target version:Candidate for next major release
Resolution: Affected version:

Description

There is a tricky problems for the ordering of WikiPages under Postgresql, the title is designed to be case insensitive.
https://github.com/redmine/redmine/blob/24ccf9d981d907ec7c8fa3901d0a79bc7f641825/app/models/wiki_page.rb#L49

But when it comes to order the wiki pages, it’s ordered in a case sensitive way, which results in the three WikiPages titled with ["Aac", "Aace_", "ABc", "Acc”] is ordered as `["ABc", "Aac", "Aace_", "Acc"] `, which is not correct since `"Aac", “Aace_"` should precede `"ABc”`.

A quick fix would be change the

 order(:title)
to
order('lower(title)’)
, patch is attached.

The order works well under mysql since mysql will order regardless of the case. But I think it should also work properly under Postgresql.

patch.rb Magnifier (566 Bytes) hyper loop, 2019-05-01 22:01

patch.diff Magnifier (566 Bytes) hyper loop, 2019-05-01 22:03

patch2.diff Magnifier (520 Bytes) hyper loop, 2019-05-01 22:14

History

#1 Updated by hyper loop 18 days ago

#2 Updated by hyper loop 18 days ago

Similar for

 has_many :pages, lambda {order('title')}, :class_name => 'WikiPage', :dependent => :destroy
https://github.com/redmine/redmine/blob/24ccf9d981d907ec7c8fa3901d0a79bc7f641825/app/models/wiki.rb#L23, which should be
  has_many :pages, lambda {order('lower(title)')}, :class_name => 'WikiPage', :dependent => :destroy 

patch is attached too.

#3 Updated by Go MAEDA 8 days ago

  • Target version set to Candidate for next major release

Also available in: Atom PDF