Skip to content

Action: Validate inline link-objects#468

Open
drfho wants to merge 5 commits intomainfrom
fb_validate_link_obj
Open

Action: Validate inline link-objects#468
drfho wants to merge 5 commits intomainfrom
fb_validate_link_obj

Conversation

@drfho
Copy link
Contributor

@drfho drfho commented Mar 4, 2026

The custom-command searches inline-links in any text-typed fields and tries to resolve/fix the target of the href-attribute. The current ZMS-codes applies the href-value as relative URL and fits it dynamically on rendering on basis of the data-uid-atttribute (by zmsindex-query). So actually the UID has to be resolved on any rendering and the URL fitted "in-context".

Fitting the URL to the published context

The inline-links appear primarily as relative and do not work if not adjusted to the rendered/published context. The challenges when resolving a link to a target object are:

  1. The link-target depends on the PAGE-endpoint (which is usually not the editing-endpoint): deep-nesting can make the determination complicated.
  2. the published URL may look different due to host-path-changes, e.g. path-cropping
  3. in a multi-site an internal inline-link may target a different domain

Switch to Absolute Inline-URLs

To get a better performance this ex-post-computation on rendering may be saved - if the inserted URL could be utilized (in the very most cases). So instead using relative (dummy-) URLs we may think about absolute URLs. Because Zope-absolute are not the published URL in most case, we need at least the domain-name the ZMS-client servers and the URL-fragment where the published path starts. This can be provides as ZMS-config-parameters:

  1. ASP.ip_or_domain (exists)
  2. ASP.startpoint (new!)

Example:
Zope-URL like /sites/portal/client1/content/e123/e456 will result in an line-Link like https://www.test.de/e123/e456 if following config-parameters are set:

  1. ASP.ip_or_domain: www.test.de
  2. ASP.startpoint: /sites/portal/client1/content/
  3. ASP.protocol: https (default)

Screenshot: Link-Validator
image

@drfho
Copy link
Contributor Author

drfho commented Mar 4, 2026

@zmsdev:
instead of logging failures it stops the iteration process. So the action cannot get to the the end.

image image

@drfho
Copy link
Contributor Author

drfho commented Mar 4, 2026

@zmsdev
change 4dc6401 makes the running completing the run, but any handling of defect links (loging etc.) is still missing.

image

Error

 manage_refform => ob.getRefToObjs()
Traceback (most recent call last):
  File "/home/zope/src/zms-publishing/ZMS5/Products/zms/_zreferableitem.py", line 517, in getLinkObj
    ob = self.getDocumentElement().fetchReqBuff(reqBuffId)
  File "/home/zope/src/zms-publishing/ZMS5/Products/zms/_cachemanager.py", line 69, in fetchReqBuff
    return getattr(buff, reqBuffId)
AttributeError: 'Buff' object has no attribute 'portal_fak_humanwis_philhum_institute_inst_psych_content_getLinkObj.unibe/portal/fak_humanwis/philhum_institute/inst_psych'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/zope/src/zms-publishing/ZMS5/Products/zms/_zreferableitem.py", line 272, in getRefToObjs
    ref_ob = self.getLinkObj(iv)
  File "/home/zope/src/zms-publishing/ZMS5/Products/zms/_zreferableitem.py", line 536, in getLinkObj
    [l.pop(0) for x in ob.getPhysicalPath() if l[0] == x]
                                               ~^^^
IndexError: list index out of range

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.

2 participants