Remove directory symlinks before starting upload #103
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Resolves #76
The root cause was that
fs.lstat
was used instead offs.stat
. Certain paths should have been omitted from the list of files to upload and this ensures directories correctly get identified before an upload begins.false
fromstat.isDirectory()
nodejs/node#25342fs.lstat
will always return false whenisDirectory
is called if the filePath is a symbolic link. This can cause problems down the line whenfs.createReadStream
is called inside@actions/artifact
during upload.Testing
https://github.com/konradpabjan/macos-eisdir/runs/914682769?check_suite_focus=true
I used a minimal repo that a user created as part of #76
In a earlier failed run, you can see that the problematic file is a symlink: https://github.com/konradpabjan/macos-eisdir/runs/914415784?check_suite_focus=true#step:5:81
With the symlink present i first tried
lstat()
thenrealPath()
and thenisDirectory()
before that is able to correctly say if that is a directory. A single call withstat()
will correctly determine if the path is a directory. In addition, even with the full real path, I tried doingfs.createReadStream
and that would fail with the sameEISDIR
error so the symlink/directory should never be uploaded to begin with