diff --git a/pkg/api/handlers/compat/containers_archive.go b/pkg/api/handlers/compat/containers_archive.go index 35f84e3f68..ef22ec0ccc 100644 --- a/pkg/api/handlers/compat/containers_archive.go +++ b/pkg/api/handlers/compat/containers_archive.go @@ -123,17 +123,9 @@ func handlePut(w http.ResponseWriter, r *http.Request, decoder *schema.Decoder, containerName := utils.GetName(r) containerEngine := abi.ContainerEngine{Libpod: runtime} - // Docker API semantics: copyUIDGID=true means "preserve UID/GID from archive" - // Podman internal semantics: Chown=true means "chown to container user" (override archive) - // For compat requests, we need to invert the value - chown := query.Chown - if !utils.IsLibpodRequest(r) { - chown = !query.Chown - } - copyFunc, err := containerEngine.ContainerCopyFromArchive(r.Context(), containerName, query.Path, r.Body, entities.CopyOptions{ - Chown: chown, + Chown: query.Chown, NoOverwriteDirNonDir: query.NoOverwriteDirNonDir, Rename: rename, }) diff --git a/test/apiv2/23-containersArchive.at b/test/apiv2/23-containersArchive.at index 643689166e..c1b936e3a7 100644 --- a/test/apiv2/23-containersArchive.at +++ b/test/apiv2/23-containersArchive.at @@ -40,7 +40,7 @@ t HEAD "containers/${CTR}/archive?path=%2Fnon%2Fexistent%2Fpath" 404 t HEAD "containers/${CTR}/archive?path=%2Fetc%2Fpasswd" 200 # Send tarfile to container... -t PUT "/containers/${CTR}/archive?path=%2Ftmp%2F©UIDGID=true" ${HELLO_TAR} 200 '' +t PUT "/containers/${CTR}/archive?path=%2Ftmp%2F" ${HELLO_TAR} 200 '' # ...and 'exec cat file' to confirm that it got extracted into place. cat >$TMPD/exec.json < ${TMPD}/${FILE_NAME}.txt -tar --owner=2001 --group=2002 --format=posix -C $TMPD -cvf ${TAR_PATH} ${FILE_NAME}.txt &> /dev/null - -t PUT "/containers/${CTR}/archive?path=%2Ftmp%2F" ${TAR_PATH} 200 '' - -cat >$TMPD/exec.json < ${TMPD}/${FILE_NAME}.txt -tar --owner=4001 --group=4002 --format=posix -C $TMPD -cvf ${TAR_PATH} ${FILE_NAME}.txt &> /dev/null -t PUT "libpod/containers/${CTR}/archive?path=%2Ftmp%2F" ${TAR_PATH} 200 '' - -cat >$TMPD/exec.json <