Commit 5e91468 1 parent 2f38cd2 commit 5e91468 Copy full SHA for 5e91468
File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1781,7 +1781,13 @@ function readFile(path) {
1781
1781
return fs.readFileSync(path, 'utf-8');
1782
1782
}
1783
1783
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');
1785
1791
}
1786
1792
/* eslint-disable @typescript-eslint/no-explicit-any */
1787
1793
function hasErrorCode(error) {
Original file line number Diff line number Diff line change @@ -127,7 +127,13 @@ export function readFile(path: string): string {
127
127
}
128
128
129
129
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' )
131
137
}
132
138
133
139
/* eslint-disable @typescript-eslint/no-explicit-any */
You can’t perform that action at this time.
0 commit comments