mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Ensure edited scripts provided from the client with newline switches and no other changes get converted to "\n" (#22196) (#22199)
# Checklist for submitter - [x] Manual QA for all new/changed functionality
This commit is contained in:
parent
1f1bc9c949
commit
ea2a978733
1 changed files with 4 additions and 4 deletions
|
|
@ -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 {
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue