Fix files unarchiving to the root; closes pterodactyl/panel#2333

This commit is contained in:
Dane Everitt 2020-09-12 19:25:29 -07:00
parent 4ac19bd29d
commit b779c98717
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -80,6 +80,11 @@ func (fs *Filesystem) DecompressFile(dir string, file string) error {
return errors.New(fmt.Sprintf("could not parse underlying data source with type %s", reflect.TypeOf(s).String())) return errors.New(fmt.Sprintf("could not parse underlying data source with type %s", reflect.TypeOf(s).String()))
} }
return errors.Wrap(fs.Writefile(name, f), "could not extract file from archive") p, err := fs.SafePath(filepath.Join(dir, name))
if err != nil {
return errors.Wrap(err, "failed to generate a safe path to server file")
}
return errors.Wrap(fs.Writefile(p, f), "could not extract file from archive")
}) })
} }