Fix broken download of directories

(cherry picked from commit 745c9a01243b8eefc72d89d1164d7d010b80983b)
Merge remote-tracking branch 'remotes/origin/branch-2.5' into branch-2.5