fix: support symlinks when commit signing (#3359)
This commit is contained in:
parent
2f38cd26bf
commit
5e914681df
2 changed files with 14 additions and 2 deletions
8
dist/index.js
vendored
8
dist/index.js
vendored
|
@ -1781,7 +1781,13 @@ function readFile(path) {
|
|||
return fs.readFileSync(path, 'utf-8');
|
||||
}
|
||||
function readFileBase64(pathParts) {
|
||||
return fs.readFileSync(path.resolve(...pathParts)).toString('base64');
|
||||
const resolvedPath = path.resolve(...pathParts);
|
||||
if (fs.lstatSync(resolvedPath).isSymbolicLink()) {
|
||||
return fs
|
||||
.readlinkSync(resolvedPath, { encoding: 'buffer' })
|
||||
.toString('base64');
|
||||
}
|
||||
return fs.readFileSync(resolvedPath).toString('base64');
|
||||
}
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
function hasErrorCode(error) {
|
||||
|
|
|
@ -127,7 +127,13 @@ export function readFile(path: string): string {
|
|||
}
|
||||
|
||||
export function readFileBase64(pathParts: string[]): string {
|
||||
return fs.readFileSync(path.resolve(...pathParts)).toString('base64')
|
||||
const resolvedPath = path.resolve(...pathParts)
|
||||
if (fs.lstatSync(resolvedPath).isSymbolicLink()) {
|
||||
return fs
|
||||
.readlinkSync(resolvedPath, {encoding: 'buffer'})
|
||||
.toString('base64')
|
||||
}
|
||||
return fs.readFileSync(resolvedPath).toString('base64')
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
|
Loading…
Reference in a new issue