fix leading space

This commit is contained in:
Adem Baccara
2025-09-10 23:02:44 +01:00
parent 5ac3ebeabe
commit 2589076020
2 changed files with 5 additions and 6 deletions
@@ -108,14 +108,13 @@ func (r *Repository) createTempFile(dir string) (string, error) {
tempFileName := fmt.Sprintf("config%s%s", timestamp, TempSuffix)
tempFilePath := filepath.Join(dir, tempFileName)
// Create the temp file
file, err := r.fileSystem.Create(tempFilePath)
// Create the temp file with explicit 0600 permissions
f, err := r.fileSystem.OpenFile(tempFilePath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, SSHConfigPerms)
if err != nil {
return "", err
}
if err := file.Close(); err != nil {
r.logger.Warnf("failed to close temporary file %s: %v", tempFilePath, err)
if cerr := f.Close(); cerr != nil {
r.logger.Warnf("failed to close temporary file %s: %v", tempFilePath, cerr)
}
return tempFilePath, nil
@@ -97,7 +97,7 @@ func (r *Repository) createHostFromServer(server domain.Server) *ssh_config.Host
{Str: server.Alias},
},
Nodes: make([]ssh_config.Node, 0),
LeadingSpace: 1,
LeadingSpace: 4,
EOLComment: "Added by lazyssh",
SpaceBeforeComment: strings.Repeat(" ", 4),
}