func SaveHandler(writer http.ResponseWriter, req *http.Request) {
	TAG := "panopticon.SaveHandler"
	badReq := httputil.NewJSONAssertable(writer, TAG, http.StatusBadRequest, clientError)
	notFound := httputil.NewJSONAssertable(writer, TAG, http.StatusNotFound, noSuchCamera)

	imgID := httputil.ExtractSegment(req.URL.Path, 3)
	badReq.Assert(imgID != "", "missing image ID")

	img := Repository.Locate(imgID)
	notFound.Assert(img != nil, "unknown image '%s'", imgID)
	cam := System.GetCamera(img.Source)
	u := userFor(req)
	notFound.Assert(!cam.Private || u.Privileged, "attempt by '%s' to access private '%s'", u.Email, cam.ID)

	alreadyPinned := !img.Pin(MediaSaved)

	httputil.SendJSON(writer, http.StatusAccepted, &APIResponse{Artifact: struct {
		NewHandle string
		Duplicate bool
	}{img.Handle, alreadyPinned}})
}
// SaveHandler handles /client/save/
SaveHandler handles /client/save
// SaveHandler handles / client / save /
func SaveHandler(writer http.ResponseWriter, req *http.Request) {
	TAG := "panopticon.SaveHandler"
	badReq := httputil.NewJSONAssertable(writer, TAG, http.StatusBadRequest, clientError)
	notFound := httputil.NewJSONAssertable(writer, TAG, http.StatusNotFound, noSuchCamera)
	imgID := httputil.ExtractSegment(req.URL.Path, 3)
	badReq.Assert(imgID != "", "missing image ID")
	img := Repository.Locate(imgID)
	notFound.Assert(img != nil, "unknown image '%s'", imgID)
	cam := System.GetCamera(img.Source)
	u := userFor(req)
	notFound.Assert(!cam.Private || u.Privileged, "attempt by '%s' to access private '%s'", u.Email, cam.ID)
	alreadyPinned := !img.Pin(MediaSaved)
	httputil.SendJSON(writer, http.StatusAccepted, &APIResponse{Artifact: struct {
		NewHandle string
		Duplicate bool
	}{img.Handle, alreadyPinned}})
}
func SaveHandler ( writer http . ResponseWriter , req * http . Request ) { TAG := " " badReq := httputil . NewJSONAssertable ( writer , TAG , http . StatusBadRequest , clientError ) notFound := httputil . NewJSONAssertable ( writer , TAG , http . StatusNotFound , noSuchCamera ) imgID := httputil . ExtractSegment ( req . URL . Path , 3 ) badReq . Assert ( imgID != " " , " " ) img := Repository . Locate ( imgID ) notFound . Assert ( img != nil , " " , imgID ) cam := System . GetCamera ( img . Source ) u := userFor ( req ) notFound . Assert ( ! cam . Private || u . Privileged , " " , u . Email , cam . ID ) alreadyPinned := ! img . Pin ( MediaSaved ) httputil . SendJSON ( writer , http . StatusAccepted , & APIResponse { Artifact : struct { NewHandle string Duplicate bool } { img . Handle , alreadyPinned } } ) }
SaveHandler handles /client/save
SaveHandler handles / client / save