Skip to content

TA-4733: Exclude symlinks in folder export#295

Merged
Laberion Ajvazi (LaberionAjvazi) merged 2 commits into
masterfrom
TA-4733-exclude-symlink
Dec 16, 2025
Merged

TA-4733: Exclude symlinks in folder export#295
Laberion Ajvazi (LaberionAjvazi) merged 2 commits into
masterfrom
TA-4733-exclude-symlink

Conversation

@LaberionAjvazi
Copy link
Copy Markdown
Contributor

@LaberionAjvazi Laberion Ajvazi (LaberionAjvazi) commented Dec 15, 2025

Description

Used the lstat function to check if the source directory or any of its nested files are symbolic links.

  • If the sourceDir is symLink, an error will be thrown to avoid reading target files that user may not have access to
  • If a nested file/folder is symLink, it will be excluded from the resulting zip since the isFile and isFolder of the lstats result will return false if the path is a symLink.

Other: Removed unused copyDirectoryToCurrentLocation method.

Relevant links

Checklist

  • I have self-reviewed this PR
  • I have tested the change and proved that it works in different scenarios
  • I have updated docs if needed

Note

Exclude symlinks when zipping directories (error on symlink source) and add tests to validate behavior.

  • Core utils (src/core/utils/file-service.ts):
    • zipDirectoryInBatchExportFormat:
      • Throw FatalError if sourceDir is a symbolic link.
      • Use fs.lstatSync to detect and skip symlinked files/folders.
    • Remove copyDirectoryToCurrentLocation method.
  • Tests (tests/core/utils/file.service.spec.ts):
    • Add tests ensuring symlink source throws and symlinked files/folders are excluded from the zip.

Written by Cursor Bugbot for commit 04b7f98. This will update automatically on new commits. Configure here.

@sonarqubecloud
Copy link
Copy Markdown

@LaberionAjvazi Laberion Ajvazi (LaberionAjvazi) merged commit 1683f2c into master Dec 16, 2025
6 checks passed
@LaberionAjvazi Laberion Ajvazi (LaberionAjvazi) deleted the TA-4733-exclude-symlink branch December 16, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants