When the directory is '/', all the files contain a leading '/'. This can be solved by stripping the / from the filenames, or not appending the extra '/' in feeds_ftp_fetcher_list()

$filename = str_replace($directory == '/' ? '/' : $directory . '/', '', $filename);

or

$filename = str_replace($directory, '', $filename);
$filename = ltrim($filename, '/');

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dready2011’s picture

FileSize
855 bytes

I can confirm this problem, was not able to fetch files from the root directory. Barrys solution solved the issue for me, thanks for that!
I created a patch for others stumbling upon this problem.

lwalley’s picture

Without count it appears str_replace will replace all occurrences, i.e. if there are subdirectories with the same name then they would also get stripped e.g. if directory is "/dir/" and inside that there is subdirectory i.e. "/dir/dir/" then both will be stripped. And with the patch in #1 if directory is "/" then all "/" will be removed i.e. "/dir/dir/" will become "dirdir"... not sure if any of that matters i.e. whether subdirectories are included in the files list, but I'm adding a new patch that attempts to use preg_replace to only strip the value of "directory" config from the beginning of the filename followed by a forward slash. This should also account for "directory" config set to just "/".