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

Commit 8b7d633

Browse files
authored
Check path to be a file when reading certificates (#1072)
Fixes a bug when the plugins view shows an empty list.
1 parent 9460c2c commit 8b7d633

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

extensions/eclipse-che-theia-remote-impl-che-server/src/node/che-server-certificate-service-impl.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ export class CheServerCertificateServiceImpl implements CertificateService {
3131
const publicCertificates = await fs.readdir(PUBLIC_CRT_PATH);
3232
for (const publicCertificate of publicCertificates) {
3333
const certPath = path.join(PUBLIC_CRT_PATH, publicCertificate);
34-
const content = await fs.readFile(certPath);
35-
certificateAuthority.push(content);
34+
if ((await fs.pathExists(certPath)) && (await fs.stat(certPath)).isFile()) {
35+
const content = await fs.readFile(certPath);
36+
certificateAuthority.push(content);
37+
}
3638
}
3739
}
3840

extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-certificate-service-impl.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ export class K8sCertificateServiceImpl implements CertificateService {
3131
const publicCertificates = await fs.readdir(PUBLIC_CRT_PATH);
3232
for (const publicCertificate of publicCertificates) {
3333
const certPath = path.join(PUBLIC_CRT_PATH, publicCertificate);
34-
const content = await fs.readFile(certPath);
35-
certificateAuthority.push(content);
34+
if ((await fs.pathExists(certPath)) && (await fs.stat(certPath)).isFile()) {
35+
const content = await fs.readFile(certPath);
36+
certificateAuthority.push(content);
37+
}
3638
}
3739
}
3840

0 commit comments

Comments
 (0)