Skip to content

Fix GetAllFilePaths slash prefix issue and resolve test failures from #263#281

Merged
kzantow merged 4 commits into
spdx:mainfrom
jijo-OO7:fix-getallfilepath
Jun 25, 2026
Merged

Fix GetAllFilePaths slash prefix issue and resolve test failures from #263#281
kzantow merged 4 commits into
spdx:mainfrom
jijo-OO7:fix-getallfilepath

Conversation

@jijo-OO7

@jijo-OO7 jijo-OO7 commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #262

Normalize dirRoot using filepath.Abs before walking the directory to ensure
consistent path prefix handling for relative inputs such as ".".

Also updates tests by replacing t.Chdir with os.Chdir for compatibility with
older Go versions while preserving behavior.

Builds upon discussion in #263 and the earlier fix proposed by @OhioDschungel6.

Signed-off-by: OhioDschungel6 <39698795+ohiodschungel6@users.noreply.github.com>
(cherry picked from commit 710584e)
Signed-off-by: Suman Mandal <sumanmandal.intro@gmail.com>
Comment thread utils/filesystem.go
Signed-off-by: Suman Mandal <sumanmandal.intro@gmail.com>
@jijo-OO7 jijo-OO7 force-pushed the fix-getallfilepath branch from 2728959 to 704e2f4 Compare March 27, 2026 17:16
…sistent relative path handling

Signed-off-by: Suman Mandal <sumanmandal.intro@gmail.com>
@jijo-OO7 jijo-OO7 force-pushed the fix-getallfilepath branch from 704e2f4 to a43ab39 Compare March 27, 2026 17:18
@jijo-OO7

Copy link
Copy Markdown
Contributor Author

@kzantow I've updated the implementation to use filepath.Abs(dirRoot) before the walk and removed the conditional prefix handling. Let me know if this looks good.

@jijo-OO7

Copy link
Copy Markdown
Contributor Author

Hey @kzantow just a friendly ping would like your review on this when you have a moment
Thanks!

@jijo-OO7 jijo-OO7 requested a review from kzantow May 19, 2026 17:27
@jijo-OO7

Copy link
Copy Markdown
Contributor Author

@kzantow could you have a look at this when you have moment .
Thanks !

Comment thread utils/filesystem.go Outdated
Signed-off-by: Suman Mandal <sumanmandal.intro@gmail.com>
@jijo-OO7 jijo-OO7 requested a review from kzantow June 25, 2026 17:35

@kzantow kzantow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @jijo-OO7

@kzantow kzantow merged commit 932682e into spdx:main Jun 25, 2026
6 checks passed
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.

filesystem.GetAllFilePath violates its contract if the input path is "."

3 participants