From: Ian Jackson Date: Wed, 28 Jul 2021 18:18:31 +0000 (+0100) Subject: Do not leak in log piece identity of face-down cards X-Git-Tag: otter-1.0.0~163 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=1e41221d169d4217302dca54e8b1f4426275ae05;p=otter.git Do not leak in log piece identity of face-down cards Signed-off-by: Ian Jackson --- diff --git a/daemon/api.rs b/daemon/api.rs index c40fdda3..c5020cf8 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -615,6 +615,7 @@ api_route!{ ioccults,&gs.occults,gpl,gpc,ipc, "flipped" )?; + // todo: name the most visible aspect in the log gpc.face = ((RawFaceId::from(gpc.face) + 1) % nfaces).into(); return (( wrc, diff --git a/src/shapelib.rs b/src/shapelib.rs index f0168137..a59a8fc2 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -347,10 +347,15 @@ impl Item { #[throws(IE)] fn describe_face(&self, face: FaceId) -> Html { - // When we are not occulted, we can show are true identity - // even if we have a back. - let face = self.faces.get(face).unwrap_or(&self.faces[0]); - self.descs[ face.desc ].clone() + self.descs[ + if let Some(face) = self.faces.get(face) { + face.desc + } else if let Some(back) = &self.back { + return back.describe_html()?; + } else { + self.faces[0].desc + } + ].clone() } }