Fix | copyDir follows directory symlinks instead of failing with EISDIR#449
Merged
dag-andersen merged 1 commit intoJun 20, 2026
Merged
Conversation
When a local content-source directory (a Helm chart streamed for a same-repo source) contains a symlink to a directory, copyDir passed the link to copyFile. filepath.Walk reports the link via Lstat, so info.IsDir() is false; copyFile then os.Open()s the link, follows it to the target directory, and io.Copy() fails with EISDIR -- surfaced as 'failed to copy content source dir ...: ... is a directory' (Linux: copy_file_range). The whole render then aborts with 'Failed to extract resources'. Resolve symlinks in copyDir: when one targets a directory, recurse into the resolved path so its contents are materialized at the destination, matching how Argo CD's repo-server reads a chart's on-disk content. File symlinks are unchanged (copyFile already follows them). Common in charts that vendor assets via directory symlinks, e.g. files/sql -> ../../sql.
dag-andersen
approved these changes
Jun 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #448.
Problem
Rendering a same-repo source whose local Helm chart contains a symlink to a directory aborts the whole run:
copyDirwalks withfilepath.Walk(whichLstats), so a directory symlink reportsinfo.IsDir() == falseand is handed tocopyFile;os.Openfollows the link to the directory andio.Copyfails with EISDIR. Charts commonly vendor assets via directory symlinks (e.g.files/sql -> ../../sql), so this trips repo-server-api renders of same-repopath:sources.Fix
Resolve symlinks in
copyDir: when one targets a directory, recurse into the resolved path so its contents are materialized at the destination — matching how Argo CD's repo-server reads a chart on disk. File symlinks are unchanged (copyFilealready follows them).Test
Adds
TestCopyDir_FollowsDirectorySymlink, which fails onmainwith the EISDIR error and passes with the fix. Fullpkg/reposerverextractsuite passes;go vetandgofmtclean.