mirror of
https://github.com/rclone/rclone.git
synced 2026-01-07 11:03:15 +00:00
config: prevent use of windows reserved names in config file name
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/rclone/rclone/fs/config/obscure"
|
||||
"github.com/rclone/rclone/fs/fspath"
|
||||
"github.com/rclone/rclone/fs/rc"
|
||||
"github.com/rclone/rclone/lib/file"
|
||||
"github.com/rclone/rclone/lib/random"
|
||||
)
|
||||
|
||||
@@ -226,16 +227,20 @@ func GetConfigPath() string {
|
||||
//
|
||||
// Checks for empty string, os null device, or special path, all of which indicates in-memory config.
|
||||
func SetConfigPath(path string) (err error) {
|
||||
var cfgPath string
|
||||
if path == "" || path == os.DevNull {
|
||||
configPath = ""
|
||||
cfgPath = ""
|
||||
} else if err = file.IsReserved(path); err != nil {
|
||||
return err
|
||||
} else {
|
||||
if configPath, err = filepath.Abs(path); err != nil {
|
||||
if cfgPath, err = filepath.Abs(path); err != nil {
|
||||
return err
|
||||
}
|
||||
if configPath == noConfigPath {
|
||||
configPath = ""
|
||||
if cfgPath == noConfigPath {
|
||||
cfgPath = ""
|
||||
}
|
||||
}
|
||||
configPath = cfgPath
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user