Skip to content

Commit 5e91468

Browse files
authored
fix: support symlinks when commit signing (#3359)
1 parent 2f38cd2 commit 5e91468

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

dist/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,13 @@ function readFile(path) {
17811781
return fs.readFileSync(path, 'utf-8');
17821782
}
17831783
function readFileBase64(pathParts) {
1784-
return fs.readFileSync(path.resolve(...pathParts)).toString('base64');
1784+
const resolvedPath = path.resolve(...pathParts);
1785+
if (fs.lstatSync(resolvedPath).isSymbolicLink()) {
1786+
return fs
1787+
.readlinkSync(resolvedPath, { encoding: 'buffer' })
1788+
.toString('base64');
1789+
}
1790+
return fs.readFileSync(resolvedPath).toString('base64');
17851791
}
17861792
/* eslint-disable @typescript-eslint/no-explicit-any */
17871793
function hasErrorCode(error) {

src/utils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ export function readFile(path: string): string {
127127
}
128128

129129
export function readFileBase64(pathParts: string[]): string {
130-
return fs.readFileSync(path.resolve(...pathParts)).toString('base64')
130+
const resolvedPath = path.resolve(...pathParts)
131+
if (fs.lstatSync(resolvedPath).isSymbolicLink()) {
132+
return fs
133+
.readlinkSync(resolvedPath, {encoding: 'buffer'})
134+
.toString('base64')
135+
}
136+
return fs.readFileSync(resolvedPath).toString('base64')
131137
}
132138

133139
/* eslint-disable @typescript-eslint/no-explicit-any */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy