Skip to content

[BUGFIX] Render Typolinks in publications exports - #92

Merged
tinzog merged 1 commit into
in2code-de:typo3-13from
zecm-via:bugfix/url-export
Nov 12, 2026
Merged

tinzog merged 1 commit into
in2code-de:typo3-13from
zecm-via:bugfix/url-export

Conversation

@YKWeyer

@YKWeyer YKWeyer commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Issue

When generating a BibTex or XML export, link fields are returned as they are stored in the database. Sometimes, it results in invalid URLs, especially when backend editors have used the link browser to link to local pages or files:

@Article { 
    …
    file_url = {t3://file?uid=331600}
    web_url = {t3://page?uid=43620}
}

Suggested changes

Extend the Controller to render all internal links when calling download Actions.

An other option would have been to edit the templates (DownloadBibtex.xml and DownloadXml.xml) to add special cases for URL fields (file_url, web_url and web_url2) and render the links there. I personnaly found it more flexible and understandable to do it within the Controller, but I can change it if you prefer to do it in the template.

Resolves #94

tinzog added a commit that referenced this pull request Nov 12, 2026
…export

Follow-up to #92, which renders typolinks in the BibTeX and XML
exports.

- Move link resolution from the controller into the new PublicationExportService. It resolves web_url, web_url2
  and file_url with the LinkFactory to absolute URLs and returns the export properties per publication uid, so
  the publication entities are no longer modified. The templates read {exportProperties.{publication.uid}}.
- Resolve every value of the link fields, not only t3:// links, so page uids and fileadmin paths become absolute
  URLs as well. Omit a link field if the link cannot be resolved (hidden or deleted page, missing file) instead of
  exporting the raw t3:// value.
- Name the link fields explicitly instead of reading typolink columns from the TCA, and create a content object
  if the request has none.
- Escape all values and author names in the XML export. Resolved URLs with parameters and titles containing "&"
  produced invalid XML.

Related: #94
Related: https://projekte.in2code.de/issues/85318
@tinzog
tinzog merged commit 2ab795e into in2code-de:typo3-13 Nov 12, 2026
9 checks passed
@tinzog

tinzog commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Thanks a lot for this PR, @YKWeyer!

You asked whether to do this in the controller or in the template. We went with a third option, a domain service, and added two follow-up commits on top of your merged change:

  • ce07e0e [BUGFIX] Resolve export links in a domain service and escape the XML export
  • 088f49c [TEST] Add functional tests for links in BibTeX and XML exports

What changed:

  • Domain service: The links are now resolved in a new PublicationExportService using TYPO3's LinkFactory. It returns the export values per publication, and the templates read them from {exportProperties.{publication.uid}}. The publications themselves are no longer modified, so absolute URLs can't end up in the database.
  • Link fields: web_url, web_url2 and file_url are named explicitly instead of being read from the TCA. All their values are resolved, so page IDs and fileadmin paths also become absolute URLs.
  • Unresolvable links: A link that can't be resolved (hidden or deleted page, missing file) is left out of the export instead of being exported as t3://….
  • XML escaping: Generated URLs often contain & (e.g. with cHash), and the XML template ran with {escaping off}, so the file became invalid. All values in the XML export are now escaped, which also fixes the same problem for titles containing &.
  • Tests: Functional tests download both exports and check the resolved links, the omitted link and that the XML is well-formed.

Thanks again for the contribution!

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.

BibTeX and XML exports contain unresolved t3:// links

2 participants