Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: On selecting Filename => Title, allow chars ( ) ,  (Read 3403 times)

0 Members and 1 Guest are viewing this topic.

fdcusa

  • Coppermine newbie
  • Country: 00
  • Offline Offline
  • Posts: 8
    • FDCUSA Museum
On selecting Filename => Title, allow chars ( ) ,
« on: February 08, 2015, 10:25:47 pm »

My filenames have parens, commas, and underlines in them.  After uploading files, the filename => Title option under Admin Tools gratiously copies the filename to the Title; however, it replaces ( with "28", ) with "29", and comma with "2C" (and underline to space).  I presume that is the hex ascii code.

Is it possible to modify the code allow parens and commas to pass through without change?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15639
Re: On selecting Filename => Title, allow chars ( ) ,
« Reply #1 on: February 09, 2015, 09:46:11 pm »

Please re-check your file names after you've added them to your Coppermine gallery. Some time ago we decided to replace almost all non-alphanumerical characters in file names, for compatibility reasons:
Code: (include/functions.inc.php) [Select]
    $condition = array (
        'transliteration' => true,
        'special_chars' => true
    );
    $condition = CPGPluginAPI::filter('replace_forbidden_conditions', $condition);

    /**
     * Transliteration
     */
    if ($condition['transliteration']) {
        require_once('include/transliteration.inc.php');
        $return = transliteration_process($return, '_');
    }

    /**
     * Replace special chars
     */
    if ($condition['special_chars']) {
        $return = str_replace('%', '', rawurlencode($return));
    }

That's maybe too much for some people in some cases, so we added a plugin hook to disable either one or both methods.


I assume the "filename => title" feature works as expected, as the characters have already replaced in your file names. You maybe want to set $condition['special_chars'] to false for future file uploads.
Logged

fdcusa

  • Coppermine newbie
  • Country: 00
  • Offline Offline
  • Posts: 8
    • FDCUSA Museum
Re: On selecting Filename => Title, allow chars ( ) ,
« Reply #2 on: February 09, 2015, 10:53:15 pm »

Thank you, Αndré!   :)

Until I understand the code better I have disabled 'special_chars' as you suggested and no conversion is done. 

Yes, "filename => title" is working as advertised.
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.