mirror of
https://github.com/Adembc/lazyssh.git
synced 2026-07-14 12:13:34 +02:00
fix leading space
This commit is contained in:
@@ -108,14 +108,13 @@ func (r *Repository) createTempFile(dir string) (string, error) {
|
|||||||
tempFileName := fmt.Sprintf("config%s%s", timestamp, TempSuffix)
|
tempFileName := fmt.Sprintf("config%s%s", timestamp, TempSuffix)
|
||||||
tempFilePath := filepath.Join(dir, tempFileName)
|
tempFilePath := filepath.Join(dir, tempFileName)
|
||||||
|
|
||||||
// Create the temp file
|
// Create the temp file with explicit 0600 permissions
|
||||||
file, err := r.fileSystem.Create(tempFilePath)
|
f, err := r.fileSystem.OpenFile(tempFilePath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, SSHConfigPerms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
if cerr := f.Close(); cerr != nil {
|
||||||
if err := file.Close(); err != nil {
|
r.logger.Warnf("failed to close temporary file %s: %v", tempFilePath, cerr)
|
||||||
r.logger.Warnf("failed to close temporary file %s: %v", tempFilePath, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempFilePath, nil
|
return tempFilePath, nil
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ func (r *Repository) createHostFromServer(server domain.Server) *ssh_config.Host
|
|||||||
{Str: server.Alias},
|
{Str: server.Alias},
|
||||||
},
|
},
|
||||||
Nodes: make([]ssh_config.Node, 0),
|
Nodes: make([]ssh_config.Node, 0),
|
||||||
LeadingSpace: 1,
|
LeadingSpace: 4,
|
||||||
EOLComment: "Added by lazyssh",
|
EOLComment: "Added by lazyssh",
|
||||||
SpaceBeforeComment: strings.Repeat(" ", 4),
|
SpaceBeforeComment: strings.Repeat(" ", 4),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user