Fix the trailing slash bug described in issue #8024 by conditionally adding a slash only for filesystem type, not for singlefile. Also update the expected test output to match the correct order.