fix macos panic dereferencing when passing a []byte version of certificate or key as cert|keyFileOrContents to iris.TLS()

if len(certFileOrContents) > 1024 the error returned will be Filename too long and os.IsNotExist(err) will be false
This commit is contained in:
Kim 2021-08-12 14:03:40 +02:00
parent b2cc3a2871
commit b4c9e7124a

View File

@ -517,9 +517,10 @@ func (su *Supervisor) shutdownOnInterrupt(ctx context.Context) {
// fileExists tries to report whether a local physical file of "filename" exists. // fileExists tries to report whether a local physical file of "filename" exists.
func fileExists(filename string) bool { func fileExists(filename string) bool {
info, err := os.Stat(filename) info, err := os.Stat(filename)
if os.IsNotExist(err) { if err != nil {
return false return false
} }
return !info.IsDir() return !info.IsDir()
} }