Allow to accept paths with no ending trailing slash. Based on a patch by rogerdpack <rogerpack2005@gmail.com>.