mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
zip downloads: make zip entries relative to the current dir when possible
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -1811,6 +1811,11 @@ func TestZipErrors(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "write error")
|
||||
}
|
||||
|
||||
err = addZipEntry(wr, connection, "/"+filepath.Base(testDir), path.Join("/", filepath.Base(testDir), "dir"))
|
||||
if assert.Error(t, err) {
|
||||
assert.Contains(t, err.Error(), "is outside base dir")
|
||||
}
|
||||
|
||||
testFilePath := filepath.Join(testDir, "ziptest.zip")
|
||||
err = os.WriteFile(testFilePath, util.GenerateRandomBytes(65535), os.ModePerm)
|
||||
assert.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user