Fix various problems preventing documents and dirs to be uploaded/edited in a session - refs BT#7128