Fix operations on folders with trailing spaces in name (#1489419)