seems that php pathinfo function not properly works with UTF file names (prooflink: http://ua.php.net/manual/en/function.pathinfo.php#79980)
For example when I'll try upload files with name "тест.txt" I'll get files with names like "txt", "txt_0" and so on (transliteration module do not fixed this)
attached patch fixes this problem for me.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | Selection_280.png | 13.98 KB | dave reid |
| #12 | 1292436.png | 50.09 KB | deciphered |
| #5 | filefield_paths-remove_pathinfo-1292436-5.patch | 1.49 KB | maximpodorov |
| #1 | 1292436-pathinfo_utf.patch | 1.19 KB | internetdevels |
Comments
Comment #1
internetdevels commentedoops, now added patch that missed in issue :)
Comment #2
fenda commented+1 subscribing
I'd also like this to be fixed!
Comment #3
dave reidNote that Drupal 7 (with it's requirement for PHP 5.2) doesn't seem to have this problem. Looks like this was fixed in PHP 5.2.0: https://bugs.php.net/bug.php?id=37945
Comment #4
maximpodorov commentedNo. The problem exists, since Drupal 7 sets single-byte locale in bootstrap.inc:
setlocale(LC_ALL, 'C');
I'll make the patch for 7.x-1.x.
Comment #5
maximpodorov commentedThe patch for 7.x-1.x solves the problem.
Comment #6
andypostThat's why
drupal_basename()is introduced!Comment #7
decipheredWhile in general the fix looks ok, I'm unable to reproduce the issue and I don't like committing patches without first confirming the issue and that the patch fixes the issue.
Comment #8
maximpodorov commentedThat PHP documentation page shows the example:
print_r(pathinfo("/mnt/files/飛兒樂團光茫.mp3"));
.. will display:
Array
(
[dirname] => /mnt/files
[basename] => .mp3
[extension] => mp3
[filename] =>
)
I confirm that executing this code from Drupal produces the specified result.
Comment #9
deciphered@maximpodorov,
Unfortunately that's not helpful, because naming a file '飛兒樂團光茫.txt' or 'тест.txt' works as expected without the patch, which implies that this is actually a non-issue, or that there is something environment specific that hasn't been provided in this issue.
Comment #10
maximpodorov commentedDo you mean that $replacements[$original] must be empty for the file 'тест.txt'?
Comment #11
andypost@Deciphered that's why we have drupal_basename() in first place
You can't said to all users to upload files with ascii filenames
Comment #12
deciphered@maximpodorov
As you can see below, running the code as you suggested doesn't not cause the issue expected, and as such, there would be no need to apply a patch to fix an issue that doesn't exist:

I don't doubt that the issue does exists, but no one has given me a way to reproduce the issue yet.
What I would suggest is this:
- Fork https://github.com/Decipher/filefield_paths
- Signup to https://travis-ci.org/ (if you haven't already) and add your forked repo
- Add a simpletest that reproduces the issue and fails
- Push that test to your fork
- Ensure that that test also fails on Travis CI
- Send me the link to the fork and the test results in Travis
Alternatively, give me some steps on how i can 100% confirm this issue.
Comment #13
dave reidI can confirm this on my system, Ubuntu 14.04.
Comment #14
deciphered@Dave Reid,
Thanks. I suspect it's just a server thing, maybe the versions of PHP I have installed via Homebrew on OS X compensate for it. My concern is that I have not yet seen the issue and as such I don't want to blindly commit the fix.
I'll try it out on a Simplytest.me instance and see if I can reproduce it there.
Comment #15
decipheredOk, issue confirmed, patch confirmed to resolve this issue, I just need to do some additional tests to ensure that the patch doesn't cause any other issues.
Comment #17
decipheredThanks for the hard work and patience (or lack there-of if it is so), tests written, failing without the patch as expected and pass with the patch.
Patch committed and pushed.
Comment #18
andypost@Deciphered Thanx a lot, now waiting for the next beta ;)