feat: add mediaType to the blob and location#573
Closed
Skarlso wants to merge 3 commits into
Closed
Conversation
Skarlso
commented
Aug 15, 2025
Signed-off-by: Gergely Brautigam <gergely.brautigam@sap.com>
dcb8535 to
e85abf2
Compare
fabianburth
reviewed
Aug 18, 2025
| ) | ||
|
|
||
| replace ( | ||
| ocm.software/open-component-model/bindings/go/blob => ../blob |
Member
There was a problem hiding this comment.
I think these will disappear right?
Contributor
Author
There was a problem hiding this comment.
absolutely. I'll have separate prs ready once the whole looks okay. :)
…nd default file mediatype On-behalf-of: gergely.brautigam@sap.com Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
02232f0 to
f6ae8d2
Compare
Skarlso
commented
Aug 19, 2025
| return nil, fmt.Errorf("error copying blob data: %w", err) | ||
| } | ||
|
|
||
| mediaType := "application/x-gzip" |
Contributor
Author
There was a problem hiding this comment.
Maybe I'll just leave it as an empty string?
Skarlso
commented
Aug 21, 2025
Comment on lines
+22
to
+33
|
|
||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| if location.MediaType != "" { | ||
| if mtOverrideable, ok := b.(blob.MediaTypeOverrideable); ok { | ||
| mtOverrideable.SetMediaType(location.MediaType) | ||
| } | ||
| } | ||
|
|
||
| return b, nil |
Contributor
Author
There was a problem hiding this comment.
This will be replaced with
// CreateBlobData creates a blob based on the location.
func CreateBlobData(location types.Location) (blob.ReadOnlyBlob, error) {
var b blob.Blob
var err error
switch location.LocationType {
case types.LocationTypeLocalFile:
b, err = filesystem.GetBlobFromOSPath(location.Value)
default:
return nil, fmt.Errorf("unsupported location type: %s", location.LocationType)
}
if err != nil {
return nil, err
}
w := direct.New(direct.NewReadCloserWrapper(b), direct.WithMediaType(location.MediaType))
return w, nil
}Once #593 is merged.
jakobmoellerdev
pushed a commit
that referenced
this pull request
Aug 21, 2025
…#593) <!-- markdownlint-disable MD041 --> #### What this PR does / why we need it This creates a wrapper for ReadOnlyBlobs so they can act like a MediaType aware blob. This is part of #573. The reason here is, that we don't want filesystem to be modified to be media type aware. Rather we can wrap it in a direct blob that will be able to call the underlying reader and even add capabilities to it, like being media type aware. Such a wrapper could be created like this: ```go w := direct.New(direct.NewReadCloserWrapper(b), direct.WithMediaType(location.MediaType)) ``` This will create a wrapper that is a `blob.ReadOnlyBlob`. #### Which issue(s) this PR fixes <!-- Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> --------- Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
Skarlso
added a commit
that referenced
this pull request
Aug 22, 2025
<!-- markdownlint-disable MD041 --> #### What this PR does / why we need it This is the plugin part for #573. Another will be the implementation on the plugin once mediatype is made available. #### Which issue(s) this PR fixes <!-- Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com> Co-authored-by: Jakob Möller <jakob.moeller@sap.com>
jakobmoellerdev
pushed a commit
that referenced
this pull request
Aug 22, 2025
<!-- markdownlint-disable MD041 --> #### What this PR does / why we need it Part of #573 that modifies helm plugin. #### Which issue(s) this PR fixes <!-- Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
Contributor
Author
|
This is now done as all interim parts have been merged. 🎉 |
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.
What this PR does / why we need it
I know, I know. I will release the modules separately, but instead of a gazillion prs and discussions on separate pages, I wanted to discuss the changes together because they are small enough.
Fixed #564
Part Of open-component-model/ocm-project#553 and needed for #530
Which issue(s) this PR fixes