This restores the symlink handling behaviour prior to 94812cca98. Fixes #9298. (cherry picked from commit 31ebc6028b3682969d86a7b39ae87131c41cc604)
94812cca98