If you try to use this module with files that begin with non-US-ASCII characters, the filenames get truncated. This is because S3fsStreamWrapper.inc uses PHP's basename() in three places, instead of Drupal's drupal_basename.

For example, a file on s3 called "личный профиль.pdf" will be stored in the file_managed table as " профиль.pdf" (with a leading space).

Let me know if you need a patch for this change, otherwise it really is just a find-and-replace of the three basename() calls, replacing with drupal_basename(). I've marked the issue priority as major, since this bug essentially breaks the module's functionality completely for many non-English filenames.

Comments

jeff h created an issue. See original summary.

coredumperror’s picture

Oh wow! I'm kindof shocked that such a huge problem has gone unreported for so many years. Though I'm not at all shocked that PHP sucks so much that its basename() function would be this broken. That's just par for the shitcourse with PHP.

I wish I'd known about drupal_basename() back when I wrote that code. I'll go ahead and do the search-and-replace, then do a new official release, to get that fix out there ASAP.

  • coredumperror committed be12735 on 7.x-2.x
    Issue #2978480: Switched to drupal_basename() because PHP's basename()...
coredumperror’s picture

Status: Active » Fixed

Alright, s3fs 7.x-2.11 is out now.

Status: Fixed » Closed (fixed)

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

jeff h’s picture

Thanks for such a prompt fix. Incredible how broken PHP is sometimes 😮