Don't include files and folders with identical name prefixes when archiving; closes pterodactyl/panel#3946
This commit is contained in:
parent
7ededdb9a2
commit
37e4d57cdf
|
@ -4,6 +4,7 @@
|
||||||
### Fixed
|
### Fixed
|
||||||
* Fixes file upload size not being properly enforced.
|
* 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 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`)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* CPU limit fields are only set on the Docker container if they have been specified for the server — otherwise they are left empty.
|
* CPU limit fields are only set on the Docker container if they have been specified for the server — otherwise they are left empty.
|
||||||
|
|
|
@ -130,7 +130,7 @@ func (a *Archive) withFilesCallback(tw *tar.Writer) func(path string, de *godirw
|
||||||
for _, f := range a.Files {
|
for _, f := range a.Files {
|
||||||
// If the given doesn't match, or doesn't have the same prefix continue
|
// If the given doesn't match, or doesn't have the same prefix continue
|
||||||
// to the next item in the loop.
|
// to the next item in the loop.
|
||||||
if p != f && !strings.HasPrefix(p, f) {
|
if p != f && !strings.HasPrefix(strings.TrimSuffix(p, "/")+"/", f) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user