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

checkPathAgainstBase with basePath '/'

Open tsu1980 opened this issue 2 years 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

Would you be able to contribute this code yourself? This is a fully open source project and only thrives when the community feeds back into it. I can make the change, but it's your discovery and you should get the recognition for it.

daveshanley avatar Oct 07 '23 12:10 daveshanley

can you check with the latest version v0.0.47 ?

emilien-puget avatar Apr 11 '24 09:04 emilien-puget