Currently the module allows conversion of new filenames to lower-case.

There is also an option to transliterate existing filenames, but this doesn't change their case.

I want all filenames to be lower-case so as a quick work-around I edited function transliteration_file_query in transliteration.admin.inc, changing
$operator = 'NOT REGEXP';
to
$operator = 'NOT REGEXP BINARY';
The problem is that by default, MySQL's "REGEXP is not case sensitive, except when used with binary strings." (see http://dev.mysql.com/doc/refman/5.1/en/regexp.html). Adding the 'BINARY' makes it case sensitive.

Comments

amateescu’s picture

Title: Allow conversion of existing filenames lower-case » Allow conversion of existing filenames to lower-case
Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Active » Fixed

Research checks out on Drupal 6, couldn't reproduce on Drupal 7.14 though, but I committed the same patch to both 6.x-3.x and 7.x-3.x anyway. Thanks for finding this issue and providing a simple solution for it :)

http://drupalcode.org/project/transliteration.git/commit/4307b0b
http://drupalcode.org/project/transliteration.git/commit/f32017f

davidhk’s picture

Status: Fixed » Active

Mine was a quick hack, but for the real patch will there need to be a check to see whether the user has ticked the "Lowercase transliterated file names." box?

amateescu’s picture

Status: Active » Fixed

That check is happening in transliteration_retroactive_submit() L:86 $filename = transliteration_clean_filename(basename($file->uri));. This 'hack' was only about getting all potential filenames from the db, right?

davidhk’s picture

Status: Fixed » Active

But up in transliteration_retroactive(), it uses the query to decide whether there are any filenames that need transliterating.

On a mixed-case filesystem, if there are any filenames with upper-case letters the "$operator = 'NOT REGEXP BINARY'; " will show to the user that there are filenames that need transliterating. If they then click the button to transliterate, the check in transliteration_clean_filename(basename($file->uri)) means nothing will be done.

Might be confusing for the user?

amateescu’s picture

That's what I thought as well after posting my previous comment. I'll fix this in a couple of days if you don't beat me to it with a patch :)

amateescu’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.