Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Check path to be a file when reading certificates #1072

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export class CheServerCertificateServiceImpl implements CertificateService {
const publicCertificates = await fs.readdir(PUBLIC_CRT_PATH);
for (const publicCertificate of publicCertificates) {
const certPath = path.join(PUBLIC_CRT_PATH, publicCertificate);
const content = await fs.readFile(certPath);
certificateAuthority.push(content);
if ((await fs.pathExists(certPath)) && (await fs.stat(certPath)).isFile()) {
const content = await fs.readFile(certPath);
certificateAuthority.push(content);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export class K8sCertificateServiceImpl implements CertificateService {
const publicCertificates = await fs.readdir(PUBLIC_CRT_PATH);
for (const publicCertificate of publicCertificates) {
const certPath = path.join(PUBLIC_CRT_PATH, publicCertificate);
const content = await fs.readFile(certPath);
certificateAuthority.push(content);
if ((await fs.pathExists(certPath)) && (await fs.stat(certPath)).isFile()) {
const content = await fs.readFile(certPath);
certificateAuthority.push(content);
}
}
}

Expand Down