properly resolve relative symlinks

This commit is contained in:
Rob Herley
2024-10-08 12:35:48 -04:00
parent c18a7d2f73
commit 545e0e6b95
5 changed files with 83 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
import * as stream from 'stream'
import {readlink} from 'fs/promises'
import {realpath} from 'fs/promises'
import * as archiver from 'archiver'
import * as core from '@actions/core'
import {UploadZipSpecification} from './upload-zip-specification'
@@ -46,7 +46,7 @@ export async function createZipUploadStream(
// Check if symlink and resolve the source path
let sourcePath = file.sourcePath
if (file.stats.isSymbolicLink()) {
sourcePath = await readlink(file.sourcePath)
sourcePath = await realpath(file.sourcePath)
}
// Add the file to the zip