还漏的一个边界

This commit is contained in:
Xu Chang 2023-07-07 21:00:05 +08:00
parent 6dde36ef83
commit 0c83caba1a
2 changed files with 7 additions and 2 deletions

View File

@ -131,7 +131,10 @@ var RelationAuth = /** @class */ (function () {
return true;
}).map(function (path) {
// 这里anchor的relativePath按长度倒排所以找到的第一个匹配关系应该就是最准确的
var relatedAnchor = anchors.find(function (anchor) { return path[1].startsWith("".concat(anchor.relativePath, ".")) || path[1] === anchor.relativePath; });
var relatedAnchor = anchors.find(function (anchor) { return path[1].startsWith("".concat(anchor.relativePath, "."))
|| path[1] === anchor.relativePath
|| !anchor.relativePath; } // relativePath如果是'', 所有的路径都成立
);
if (relatedAnchor) {
var entity_1 = relatedAnchor.entity, relativePath_1 = relatedAnchor.relativePath, filter_2 = relatedAnchor.filter;
var restPath = relativePath_1 === path[1] ? '' : relativePath_1 === '' ? path[1] : path[1].slice(relativePath_1.length + 1);

View File

@ -186,7 +186,9 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict>{
(path) => {
// 这里anchor的relativePath按长度倒排所以找到的第一个匹配关系应该就是最准确的
const relatedAnchor = anchors.find(
(anchor) => path[1].startsWith(`${anchor.relativePath}.`) || path[1] === anchor.relativePath
(anchor) => path[1].startsWith(`${anchor.relativePath}.`)
|| path[1] === anchor.relativePath
|| !anchor.relativePath // relativePath如果是'', 所有的路径都成立
);
if (relatedAnchor) {
const { entity, relativePath, filter } = relatedAnchor;