Skip to content

fix(smartlink): redirect to CRE page directly when only one CRE is linked#906

Open
shreeshtripurwarcomp23-coder wants to merge 1 commit into
OWASP:mainfrom
shreeshtripurwarcomp23-coder:fix/smartlink-single-cre-redirect-486
Open

fix(smartlink): redirect to CRE page directly when only one CRE is linked#906
shreeshtripurwarcomp23-coder wants to merge 1 commit into
OWASP:mainfrom
shreeshtripurwarcomp23-coder:fix/smartlink-single-cre-redirect-486

Conversation

@shreeshtripurwarcomp23-coder
Copy link
Copy Markdown

Summary

Fixes #486

What changed

When smartlink resolves to a standard node (e.g. CWE/611) that has
exactly one connected CRE, the user is now redirected directly to
/cre/{id} instead of stopping at the intermediate /node/... page.

The CRE page already contains all the information the node page shows,
so the extra click was unnecessary friction.

If zero or multiple CREs are linked, the existing behavior is preserved.

How it works

In web_main.py → smartlink(), after finding the node, we filter
nodes[0].links for CRE-typed documents. If exactly one is found,
we extract its id and redirect to /cre/{id}.

Tests

  • Updated two existing test_smartlink assertions to expect the new
    /cre/{id} redirect for single-CRE nodes
  • Added a new multi-CRE case: a second CRE is linked to the same node,
    confirming the fallback to the node page still works
  • All 28 web_main tests pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make smartlink go to CRE directly

1 participant