Skip to content

Commit

Permalink
Ensure edited scripts provided from the client with newline switches …
Browse files Browse the repository at this point in the history
…and no other changes get converted to "\n" (#22196) (#22199)

# Checklist for submitter

- [x] Manual QA for all new/changed functionality
  • Loading branch information
iansltx authored Sep 18, 2024
1 parent 1f1bc9c commit ea2a978
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ee/server/service/software_installers.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,16 @@ func (svc *Service) UpdateSoftwareInstaller(ctx context.Context, payload *fleet.

if installScript != existingInstaller.InstallScript {
dirty["InstallScript"] = true
payload.InstallScript = &installScript
}
payload.InstallScript = &installScript
}

if payload.PostInstallScript != nil {
postInstallScript := file.Dos2UnixNewlines(*payload.PostInstallScript)
if postInstallScript != existingInstaller.PostInstallScript {
dirty["PostInstallScript"] = true
payload.PostInstallScript = &postInstallScript
}
payload.PostInstallScript = &postInstallScript
}

if payload.UninstallScript != nil {
Expand All @@ -271,10 +271,10 @@ func (svc *Service) UpdateSoftwareInstaller(ctx context.Context, payload *fleet.

preProcessUninstallScript(payloadForUninstallScript)
if payloadForUninstallScript.UninstallScript != existingInstaller.UninstallScript {
uninstallScript = payloadForUninstallScript.UninstallScript
dirty["UninstallScript"] = true
payload.UninstallScript = &uninstallScript
}
uninstallScript = payloadForUninstallScript.UninstallScript
payload.UninstallScript = &uninstallScript
}

// persist changes starting here, now that we've done all the validation/diffing we can
Expand Down

0 comments on commit ea2a978

Please sign in to comment.