refactor(cloudfunc) rmLastSlash: add check