working commit
This commit is contained in:
@@ -86,6 +86,7 @@ func (hand *Handler) ManifestExists(rctx *router.Context) {
|
|||||||
// pushes of at least 4 megabytes.
|
// pushes of at least 4 megabytes.
|
||||||
|
|
||||||
// PUT /v2/<name>/manifests/<reference> 201 404
|
// PUT /v2/<name>/manifests/<reference> 201 404
|
||||||
|
|
||||||
func (hand *Handler) PutManifest(rctx *router.Context) {
|
func (hand *Handler) PutManifest(rctx *router.Context) {
|
||||||
|
|
||||||
hand.DumpHeaders("PutManifest headers", rctx)
|
hand.DumpHeaders("PutManifest headers", rctx)
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package auxtool
|
||||||
|
|
||||||
|
import (
|
||||||
|
"path/filepath"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CleanDirs(basedir, datadir string) {
|
||||||
|
separator := string(os.PathSeparator)
|
||||||
|
|
||||||
|
basedir = filepath.Clean(separator + basedir)
|
||||||
|
datadir = filepath.Clean(separator + datadir)
|
||||||
|
|
||||||
|
items := strings.Split(datadir, separator)
|
||||||
|
for i := len(items); i > 0; i-- {
|
||||||
|
p := filepath.Join(items[0:i]...)
|
||||||
|
p = filepath.Clean(separator + p)
|
||||||
|
if p == basedir {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fileInfo, err := os.Stat(p)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if fileInfo.IsDir() {
|
||||||
|
err = os.Remove(p)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user