mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 03:13:41 +08:00
fix(memory): HiL edit uses exact key match, not substring contains
This commit is contained in:
parent
b02f2ebfee
commit
2eebdf2a47
@ -152,8 +152,14 @@ public class DreamController {
|
||||
.ge(MemoryRecallEntity::getLastRecalledAt, report.getStartedAt())
|
||||
.le(MemoryRecallEntity::getLastRecalledAt, report.getFinishedAt())
|
||||
.eq(MemoryRecallEntity::getDeleted, 0));
|
||||
// Exact match on the section key (part after # in filename)
|
||||
boolean keyBelongsToReport = candidates.stream()
|
||||
.anyMatch(c -> c.getFilename() != null && c.getFilename().contains(decodedKey));
|
||||
.anyMatch(c -> {
|
||||
if (c.getFilename() == null) return false;
|
||||
int hash = c.getFilename().indexOf('#');
|
||||
String entryKey = hash >= 0 ? c.getFilename().substring(hash + 1) : c.getFilename();
|
||||
return entryKey.equals(decodedKey);
|
||||
});
|
||||
if (!keyBelongsToReport) {
|
||||
return R.fail("Entry '" + decodedKey + "' does not belong to report " + reportId);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user