Ticket #204 (closed defect: fixed)

Opened 20 months ago

Last modified 17 months ago

Windows: International characters, slash problem

Reported by: GezaBacsi Owned by:
Priority: normal Milestone: 1.0
Component: General Version: SVN
Severity: major Keywords:
Cc:

Description

For windows users: I use xampp from apacheFriends v.1.7.0 on Win XP SP3, plogger SVN trunk-r589. When using e.g. hungarian album and collection names on an English Win, i can't delete the album or collection, since it creates those strange directories. The resolution is in the file sanity check function, I'll paste the modified version here. It gets rid of all international characters, since you can never be sure enough. The other problem is, that PLOGGER_DIR is created with a slash, and in Win I have backslashes. So, at deletion it compares $relative_directory (ends with backslash) with $configbasedir? (ends with slash), and they are not equal because of the last character. So I switched slash to backslash (
) in the plog-globals, line 12. You could do a win check there to make it changing from OS to OS.

function sanitize_filename($str) {

allow only alphanumeric characters, hyphen, and dot in file names spaces will be changed to dashes, special chars will be suppressed, & the rest will be replaced with underscores $special_chars = array ("#","$","%","","&","*","!","~","","\"","","'","=","?","/",",?","(",")","|","<",">",";","
",","); $str = str_replace($special_chars, , $str); $str = str_replace(' ', '-', $str); return preg_replace("/[
a-zA-Z0-9s|\.]/", "_", $str);

maybe this is good too, for Unicode chars

return preg_replace("//","_",$str);

}

Change History

comment:1 Changed 19 months ago by sidtheduck

  • Status changed from new to testing

sanitize_filename code added to rev r590. Also, path deletion fixed using different code in r590 so should work on any server environment.

comment:2 Changed 17 months ago by kimparsell

  • Status changed from testing to commit

comment:3 Changed 17 months ago by kimparsell

  • Status changed from commit to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.