diff --git a/backend/services/mikrotikApplyService.js b/backend/services/mikrotikApplyService.js index d745bab..ff0634d 100644 --- a/backend/services/mikrotikApplyService.js +++ b/backend/services/mikrotikApplyService.js @@ -270,8 +270,9 @@ async function applyOperation(client, op, dryRun) { if (path === '/ip/route') { if (action === 'remove' && meta?.findComment) { - const existing = await rosPrintWithQuery(client, '/ip/route', [`~comment=${meta.findComment}`]); - const toRemove = existing; + // REST API может игнорировать regex в .query и возвращать все маршруты — фильтруем на нашей стороне + const raw = await rosPrintWithQuery(client, '/ip/route', [`~comment=${meta.findComment}`]); + const toRemove = raw.filter(r => (r.comment || '').startsWith('Recursive: ')); if (toRemove.length === 0) { result.status = 'skip'; result.details = 'No matching routes to remove';