129           if (empty($path)) {

130              foreach (explode('/', file_directory_path()) as $dir) {

131                $path .= '../';

132              }

133            }

This code in file_aliases.module inserts multiple instances of ../ into the url. Obviously this is what it is meant to do but this means that on node pages when a Filefield is displayed the url generated can look like this ../../../example.pdf when the path it should be creating is example.pdf. There is no need to include these '../' as far as I can see?

Comments

sammo’s picture

Ok It looks like the filefield module needs the path to be formatted in this way. However, it also needs the path to include the path to the site files directory. The '../' in the path then makes the path relative to the original site files directory, keeping the filefield module happy.

I changed the code to:

if (empty($path)) {
              $path = file_directory_path() . '/'; // adds original file directory to path so that it can be adjusted by the relative path
              foreach (explode('/', file_directory_path()) as $dir) {
                $path .= '../';
              }
            }

This fixed the issue

deciphered’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

The Drupal 6 version of this module will not be receiving any more support.