Skip to content

Commit

Permalink
fix bug with triggers encoded in triggers file (#1358)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <[email protected]>
  • Loading branch information
imjasonh authored Oct 28, 2024
1 parent dfd80b4 commit 524bf6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/apk/apk/installed.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (a *APK) updateTriggers(pkg *Package, controlTarGz io.Reader) error {
}

for _, value := range values {
if _, err := triggers.Write([]byte(fmt.Sprintf("%s %s\n", base64.StdEncoding.EncodeToString(pkg.Checksum), value))); err != nil {
if _, err := triggers.Write([]byte(fmt.Sprintf("Q1%s %s\n", base64.StdEncoding.EncodeToString(pkg.Checksum), value))); err != nil {
return fmt.Errorf("unable to write triggers file %s: %w", triggersFilePath, err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/apk/apk/installed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func TestUpdateTriggers(t *testing.T) {
readTriggers, err := a.readTriggers()
require.NoError(t, err, "unable to read triggers: %v", err)
defer readTriggers.Close()
cksum := base64.StdEncoding.EncodeToString(pkg.Checksum)
cksum := "Q1" + base64.StdEncoding.EncodeToString(pkg.Checksum)
// read every line in triggers, looking for one with our comment
scanner := bufio.NewScanner(readTriggers)
for scanner.Scan() {
Expand All @@ -271,7 +271,7 @@ func TestUpdateTriggers(t *testing.T) {
return
}
//nolint:forbidigo // this is a valid use case
t.Errorf("could not find entry for commit: %s", cksum)
t.Errorf("could not find entry for checksum: %s", cksum)
}

func TestSortTarHeaders(t *testing.T) {
Expand Down

0 comments on commit 524bf6e

Please sign in to comment.