Skip to content

Commit

Permalink
fix: drop the double invalid '+' in layer media-type
Browse files Browse the repository at this point in the history
For a layer media-type, we add the fstype+compression+verity_present.
Only one '+' is allowed as per following RFC.
https://datatracker.ietf.org/doc/html/rfc6838#section-4.2

Instead just rely on "root_hash" annotation.

Signed-off-by: Ramkumar Chinchani <[email protected]>
  • Loading branch information
rchincha committed Dec 4, 2024
1 parent e5a0e91 commit 68b0328
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pkg/erofs/erofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func MakeErofs(tempdir string, rootfs string, eps *common.ExcludePaths, verity v
return nil, "", rootHash, errors.WithStack(err)
}

return blob, GenerateErofsMediaType(compression, verity), rootHash, nil
return blob, GenerateErofsMediaType(compression), rootHash, nil
}

func findErofsFuseInfo() {
Expand Down
10 changes: 2 additions & 8 deletions pkg/erofs/mediatype.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package erofs
import (
"fmt"
"strings"

vrty "machinerun.io/atomfs/pkg/verity"
)

type ErofsCompression string
Expand All @@ -21,10 +19,6 @@ func IsErofsMediaType(mediaType string) bool {
return strings.HasPrefix(mediaType, BaseMediaTypeLayerErofs)
}

func GenerateErofsMediaType(comp ErofsCompression, verity vrty.VerityMetadata) string {
verityString := ""
if verity {
verityString = fmt.Sprintf("+%s", vrty.VeritySuffix)
}
return fmt.Sprintf("%s+%s%s", BaseMediaTypeLayerErofs, comp, verityString)
func GenerateErofsMediaType(comp ErofsCompression) string {
return fmt.Sprintf("%s+%s", BaseMediaTypeLayerErofs, comp)
}
10 changes: 2 additions & 8 deletions pkg/squashfs/mediatype.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package squashfs
import (
"fmt"
"strings"

vrty "machinerun.io/atomfs/pkg/verity"
)

type SquashfsCompression string
Expand All @@ -20,10 +18,6 @@ func IsSquashfsMediaType(mediaType string) bool {
return strings.HasPrefix(mediaType, BaseMediaTypeLayerSquashfs)
}

func GenerateSquashfsMediaType(comp SquashfsCompression, verity vrty.VerityMetadata) string {
verityString := ""
if verity {
verityString = fmt.Sprintf("+%s", vrty.VeritySuffix)
}
return fmt.Sprintf("%s+%s%s", BaseMediaTypeLayerSquashfs, comp, verityString)
func GenerateSquashfsMediaType(comp SquashfsCompression) string {
return fmt.Sprintf("%s+%s", BaseMediaTypeLayerSquashfs, comp)
}
2 changes: 1 addition & 1 deletion pkg/squashfs/squashfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func MakeSquashfs(tempdir string, rootfs string, eps *common.ExcludePaths, verit
return nil, "", rootHash, errors.WithStack(err)
}

return blob, GenerateSquashfsMediaType(compression, verity), rootHash, nil
return blob, GenerateSquashfsMediaType(compression), rootHash, nil
}

func findSquashFuseInfo() {
Expand Down

0 comments on commit 68b0328

Please sign in to comment.