Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some hlinks to a diagram within description raise Malformed link exception #475

Closed
vik378 opened this issue Nov 17, 2024 · 1 comment
Closed

Comments

@vik378
Copy link
Member

vik378 commented Nov 17, 2024

In IFE model (https://github.com/DSD-DBS/Capella-IFE-sample) there are hlinks within descriptions that lead to diagrams. Some of those are simply hlink://_.... but some have a trailing "/". Those with trailing slash trigger the below exception:

File "templates/common_macros.html.j2", line 189, in template
    <p>{{ obj.description | safe }}</p>
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../capella_model_explorer/backend/explorer.py", line 106, in __finalize
    return capellambse.helpers.replace_hlinks(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...python3.11/site-packages/capellambse/helpers.py", line 571, in replace_hlinks
    return process_html_fragments(markup, cb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...python3.11/site-packages/capellambse/helpers.py", line 616, in process_html_fragments
    node_callback(node)
  File "...python3.11/site-packages/capellambse/helpers.py", line 558, in cb
    obj = model.by_uuid(target)
          ^^^^^^^^^^^^^^^^^^^^^
  File "...python3.11/site-packages/capellambse/model/_model.py", line 379, in by_uuid
    return _obj.ModelElement.from_model(self, self._loader[uuid])
                                              ~~~~~~~~~~~~^^^^^^
  File "...python3.11/site-packages/capellambse/loader/core.py", line 1227, in __getitem__
    return self.follow_link(None, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...python3.11/site-packages/capellambse/loader/core.py", line 1131, in follow_link
    raise ValueError(f"Malformed link: {link!r}")
ValueError: Malformed link: '_xXSwEKv6EeSTJvLsyJitsw/'
@Wuestengecko
Copy link
Member

This was fixed in #472 already, I just hadn't made a new release with that patch yet. I've fixed that now, v0.6.10 is out 🙂

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

No branches or pull requests

2 participants