Merge branch 'develop' of https://github.com/pterodactyl/wings into develop

This commit is contained in:
Dane Everitt
2020-09-22 20:41:16 -07:00
10 changed files with 52 additions and 15 deletions

View File

@@ -600,7 +600,15 @@ func (fs *Filesystem) Copy(p string) error {
base := filepath.Base(cleaned)
relative := strings.TrimSuffix(strings.TrimPrefix(cleaned, fs.Path()), base)
extension := filepath.Ext(base)
name := strings.TrimSuffix(base, filepath.Ext(base))
name := strings.TrimSuffix(base, extension)
// Ensure that ".tar" is also counted as apart of the file extension.
// There might be a better way to handle this for other double file extensions,
// but this is a good workaround for now.
if strings.HasSuffix(name, ".tar") {
extension = ".tar" + extension
name = strings.TrimSuffix(name, ".tar")
}
// Begin looping up to 50 times to try and create a unique copy file name. This will take
// an input of "file.txt" and generate "file copy.txt". If that name is already taken, it will
@@ -943,7 +951,7 @@ func (fs *Filesystem) handleWalkerError(err error, f os.FileInfo) error {
}
type fileOpener struct {
busy uint
busy uint
}
// Attempts to open a given file up to "attempts" number of times, using a backoff. If the file
@@ -966,4 +974,4 @@ func (fo *fileOpener) open(path string, flags int, perm os.FileMode) (*os.File,
return f, err
}
}
}