Skip to content

feat(ctf): refactor OpenCTFByFileExtension for usage of discovery outside of opening CTFs#964

Merged
jakobmoellerdev merged 1 commit into
open-component-model:mainfrom
fabianburth:fix/multi-ctf-race-ctf
Sep 30, 2025
Merged

feat(ctf): refactor OpenCTFByFileExtension for usage of discovery outside of opening CTFs#964
jakobmoellerdev merged 1 commit into
open-component-model:mainfrom
fabianburth:fix/multi-ctf-race-ctf

Conversation

@fabianburth

@fabianburth fabianburth commented Sep 30, 2025

Copy link
Copy Markdown
Contributor

What this does / why we need it:

  • Refactored OpenCTFByFileExtension to separate format discovery (DiscoverCTFFormatFromPath) from CTF opening logic, enhancing code readability and maintainability.

Which issue(s) this PR fixes

Contributes to open-component-model/ocm-project#564

… and error handling

### What this does / why we need it:
- Refactored `OpenCTFByFileExtension` to separate format discovery (`DiscoverCTFFormatFromPath`) from CTF opening logic, enhancing code readability and maintainability.
- Introduced better error handling when the CTF cannot be opened, returning a more descriptive error message.
- Simplified extension handling, ensuring edge cases like `.tar.gz` are correctly handled.

### Implications:
- Removes redundant code duplication by isolating format discovery into its own function.
- Users now benefit from clearer error messages when opening a CTF fails.

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@fabianburth fabianburth requested a review from a team as a code owner September 30, 2025 09:30
@github-actions github-actions Bot added kind/feature new feature, enhancement, improvement, extension size/s Small labels Sep 30, 2025
@jakobmoellerdev jakobmoellerdev changed the title feat(ctf): refactor OpenCTFByFileExtension for improved readability and error handling feat(ctf): refactor OpenCTFByFileExtension for usage of discovery outside of opening CTFs Sep 30, 2025
Comment thread bindings/go/ctf/ctf.go

@matthiasbruns matthiasbruns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@jakobmoellerdev jakobmoellerdev merged commit 27c7c73 into open-component-model:main Sep 30, 2025
24 checks passed
matthiasbruns pushed a commit that referenced this pull request Oct 7, 2025
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
This PR fixes is supposed to fix the race conditions occuring when
multiple ctf instances operate on the same ctf archive. The actual fix
is provided in
#964
and
#963.
Here, a the archive instance and its lock are shared between multiple
ctf repositories operating on the archive.

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Contributes to
open-component-model/ocm-project#564

---------

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature new feature, enhancement, improvement, extension size/s Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants