Using version 6.x-1.1 on a Windows Server 2008 R2 box, I could not get a file to attach to a submission email unless I altered the $not_in_public_path line in mimemail.inc. I certainly may be off base, but the problem seemed to center around realpath($file) returning a Windows path with backslashes (\), but $public_path returning forward slashes (/).

realpath($file) example: [drive letter]:\some\dir\drupal\sites\thesitename\files\webform\sample.txt
$public_path example: sites/thesitename/files

So, when strpos() looks for what was in $public_path, it can't find the pattern in the realpath($file). Thus, $not_in_public_path was always returning true even on that Windows server if the file was in the public path.

So, instead of this on line 182:
$not_in_public_path = strpos(realpath($file), $public_path) === FALSE;

What about this?:
$not_in_public_path = strpos(str_replace('\\','/',realpath($file)), $public_path) === FALSE;

Thanks!

Comments

sgabe’s picture

Category: feature » bug
Status: Active » Closed (duplicate)

I think this is fixed by #2050907: No attachment if "public files" directory is a symlink., but feel free to reopen if the issue is still valid.