libopenapi-validator icon indicating copy to clipboard operation
libopenapi-validator copied to clipboard

checkPathAgainstBase with basePath '/'

Open tsu1980 opened this issue 1 year ago • 2 comments

Thanks your great job.

I found problem when Server path is no base path like this.

servers:
  - url: 'http://127.0.0.1/'

This will call checkPathAgainstBase with basePath '/'. And the checkPathAgainstBase trim basePath last slash here, but if basePath is '/', basePaths is to be empty string. It's unexpected behavior, right?

so I think the code should be fixed like this.

		if len(basePaths[i]) > 1 && basePaths[i][len(basePaths[i])-1] == '/' {
			basePaths[i] = basePaths[i][:len(basePaths[i])-1]
		}

tsu1980 avatar Sep 22 '23 06:09 tsu1980