summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2021-06-28 21:17:13 +0200
committerMatej Vasek <mvasek@redhat.com>2021-07-01 12:01:46 +0200
commit86c6014145d5b8d4ea51f338beb9bddaa8b5a334 (patch)
tree056769253cf35f00bdd46389bddd9c076c31a00e /pkg/api
parentfd1715568b7c14451dcf2581c385c8d3e307d30e (diff)
downloadpodman-86c6014145d5b8d4ea51f338beb9bddaa8b5a334.tar.gz
podman-86c6014145d5b8d4ea51f338beb9bddaa8b5a334.tar.bz2
podman-86c6014145d5b8d4ea51f338beb9bddaa8b5a334.zip
Implement --archive flag for podman cp
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/compat/containers_archive.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/api/handlers/compat/containers_archive.go b/pkg/api/handlers/compat/containers_archive.go
index e119dc7cb..a9d74e5f4 100644
--- a/pkg/api/handlers/compat/containers_archive.go
+++ b/pkg/api/handlers/compat/containers_archive.go
@@ -9,6 +9,7 @@ import (
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/api/handlers/utils"
"github.com/containers/podman/v3/pkg/copy"
+ "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/domain/infra/abi"
"github.com/gorilla/schema"
"github.com/pkg/errors"
@@ -92,11 +93,13 @@ func handleHeadAndGet(w http.ResponseWriter, r *http.Request, decoder *schema.De
func handlePut(w http.ResponseWriter, r *http.Request, decoder *schema.Decoder, runtime *libpod.Runtime) {
query := struct {
- Path string `schema:"path"`
+ Path string `schema:"path"`
+ Chown bool `schema:"copyUIDGID"`
// TODO handle params below
NoOverwriteDirNonDir bool `schema:"noOverwriteDirNonDir"`
- CopyUIDGID bool `schema:"copyUIDGID"`
- }{}
+ }{
+ Chown: utils.IsLibpodRequest(r), // backward compatibility
+ }
err := decoder.Decode(&query, r.URL.Query())
if err != nil {
@@ -107,7 +110,7 @@ func handlePut(w http.ResponseWriter, r *http.Request, decoder *schema.Decoder,
containerName := utils.GetName(r)
containerEngine := abi.ContainerEngine{Libpod: runtime}
- copyFunc, err := containerEngine.ContainerCopyFromArchive(r.Context(), containerName, query.Path, r.Body)
+ copyFunc, err := containerEngine.ContainerCopyFromArchive(r.Context(), containerName, query.Path, r.Body, entities.CopyOptions{Chown: query.Chown})
if errors.Cause(err) == define.ErrNoSuchCtr || os.IsNotExist(err) {
// 404 is returned for an absent container and path. The
// clients must deal with it accordingly.