I attached a patch that always uses file_canonical_name() so file_isdir() works for cases of "../.." directories.

As it works with canonical names, maybe it has troubles with the ".." directories inside a symlinked directory, but I imagine there may be troubles for this situation in other parts of the code too.