mirror of
https://github.com/containrrr/watchtower.git
synced 2026-01-26 02:36:10 +01:00
fix: Resolving several identified vulnerabilities
This commit is contained in:
parent
76f9cea516
commit
bc35a17f24
8 changed files with 238 additions and 178 deletions
|
|
@ -3,13 +3,14 @@ package mocks
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/onsi/ginkgo"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
|
||||
t "github.com/containrrr/watchtower/pkg/types"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
|
|
@ -260,14 +261,18 @@ func RemoveImageHandler(imagesWithParents map[string][]string) http.HandlerFunc
|
|||
func(w http.ResponseWriter, r *http.Request) {
|
||||
parts := strings.Split(r.URL.Path, `/`)
|
||||
image := parts[len(parts)-1]
|
||||
|
||||
if parents, found := imagesWithParents[image]; found {
|
||||
items := []types.ImageDeleteResponseItem{
|
||||
// Create a struct type that matches what Docker API returns for image removal
|
||||
type imageDeleteResponseItem struct {
|
||||
Untagged string `json:"Untagged,omitempty"`
|
||||
Deleted string `json:"Deleted,omitempty"`
|
||||
}
|
||||
items := []imageDeleteResponseItem{
|
||||
{Untagged: image},
|
||||
{Deleted: image},
|
||||
}
|
||||
for _, parent := range parents {
|
||||
items = append(items, types.ImageDeleteResponseItem{Deleted: parent})
|
||||
items = append(items, imageDeleteResponseItem{Deleted: parent})
|
||||
}
|
||||
ghttp.RespondWithJSONEncoded(http.StatusOK, items)(w, r)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue