Include error in log output if one occurs during move
This commit is contained in:
parent
5df1acd10e
commit
f390784973
|
@ -5,12 +5,14 @@
|
|||
* Fixes file upload size not being properly enforced.
|
||||
* Fixes a bug that prevented listing a directory when it contained a named pipe. Also added a check to prevent attempting to read a named pipe directly.
|
||||
* Fixes a bug with the archiver logic that would include folders that had the same name prefix. (for example, requesting only `map` would also include `map2` and `map3`)
|
||||
* Requests to the Panel that return a client error (4xx response code) no longer trigger an exponential backoff, they immediately stop the request.
|
||||
|
||||
### Changed
|
||||
* CPU limit fields are only set on the Docker container if they have been specified for the server — otherwise they are left empty.
|
||||
|
||||
### Added
|
||||
* Added the ability to define the location of the temporary folder used by Wings — defaults to `/tmp/pterodactyl`.
|
||||
* Adds the ability to authenticate for SFTP using public keys (requires `Panel@1.8.0`).
|
||||
|
||||
## v1.6.1
|
||||
### Fixed
|
||||
|
|
|
@ -131,6 +131,10 @@ func putServerRenameFiles(c *gin.Context) {
|
|||
// Return nil if the error is an is not exists.
|
||||
// NOTE: os.IsNotExist() does not work if the error is wrapped.
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
s.Log().WithField("error", err).
|
||||
WithField("from_path", pf).
|
||||
WithField("to_path", pt).
|
||||
Warn("failed to rename: source or target does not exist")
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
|
|
@ -171,16 +171,16 @@ func (fs *Filesystem) CreateDirectory(name string, p string) error {
|
|||
return os.MkdirAll(cleaned, 0o755)
|
||||
}
|
||||
|
||||
// Moves (or renames) a file or directory.
|
||||
// Rename moves (or renames) a file or directory.
|
||||
func (fs *Filesystem) Rename(from string, to string) error {
|
||||
cleanedFrom, err := fs.SafePath(from)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
cleanedTo, err := fs.SafePath(to)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
// If the target file or directory already exists the rename function will fail, so just
|
||||
|
@ -202,7 +202,10 @@ func (fs *Filesystem) Rename(from string, to string) error {
|
|||
}
|
||||
}
|
||||
|
||||
return os.Rename(cleanedFrom, cleanedTo)
|
||||
if err := os.Rename(cleanedFrom, cleanedTo); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Recursively iterates over a file or directory and sets the permissions on all of the
|
||||
|
|
Loading…
Reference in New Issue
Block a user