Repository navigation
Extract absolute_url from the app_api OCS response in download links - #287
Merged
Merged
Conversation
…nload links
The nextcloud_url/absolute endpoint answers with {absolute_url: ...}, but
doc_gen.py and image_gen.py f-stringed the whole dict into the download URL,
producing links like {'absolute_url': '.../task'}/104/output-file/.../download.
The chat model transcribes those with varying success (observed live: stray
'}' or %7D, 404s roughly two of three times). Extract absolute_url after the
call in both files, and cover the link construction with tests whose fake
mirrors the real endpoint's dict shape.
Signed-off-by: WSHAPER <42714629+WSHAPER@users.noreply.github.com>
Assisted-by: opencode (zai/glm-5.3)
marcelklehr
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The app_api OCS endpoint
/ocs/v2.php/apps/app_api/api/v1/info/nextcloud_url/absoluteanswers with a dict ({"absolute_url": ...}).generate_documentandgenerate_imagef-stringed the whole response into their download links, so every link came out as{'absolute_url': 'https://...'}/104/output-file/.../download. This extractsabsolute_urlafter the call in both tools.Steps to reproduce
generate_documenttoolabsolute_urlextraction (ex_app/lib/all_tools/doc_gen.py)generate_imagebuilds its link the same way (ex_app/lib/all_tools/image_gen.py)Expected behaviour
every
generate_documentandgenerate_imagelink resolves; chat links fetch 200 consistentlyActual behaviour
links are mangled and 404 roughly two of three times in live testing
Fix
Extract
absolute_urlfrom the OCS response right after the call, inex_app/lib/all_tools/doc_gen.pyandex_app/lib/all_tools/image_gen.py.Testing
tests/test_doc_gen_links.pyruns both tools against a hermetic fake whosenextcloud_urlendpoint returns the dict shape the real controller returns (this is how the bug escaped: a fake answering with a bare string cannot see it). It covers bothgenerate_documentreturn sites (default file output and slides output) and thegenerate_imagelink, and asserts the links contain the bare URL plus the task path, with no dict-repr artifacts and no stray braces.Cross-references
Assisted by opencode with zai/glm-5.3, reviewed by WSHAPER