Feature: Ability to link files opening in new page #989
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.
Dojo Asset Links Support
Dojo owners can now embed links inside dojo, module, and challenge descriptions that point to files stored in their dojo repository. Visiting a URL of the form
/dojo_id/<asset-path>renders the referenced artifact directly in the platform:/{dojo_id}/{filename}resolves dojo-level files./{dojo_id}/{module_id}/{filename}resolves module-level files./{dojo_id}/{module_id}/{challenge_id}/{filename}resolves challenge-level files.Markdown renders as HTML, PDFs stream in the browser, and LaTeX (or other plain text assets) display in a dedicated template. Requests are constrained to the owning dojo repo and reject ambiguous matches, preventing traversal outside the allowed tree.
Motivation
For the core material to be added for cryptography dojo, having long pdfs have their own dedicated page is a necessity. Previously, descriptions could only link to external hosting or expose bare markdown. This feature keeps assets in the dojo repository, preserving version control, discoverability, and offline deployability while giving students a single, predictable URL structure for supplementary content.
Implementation Details
dojo_plugin/pages/dojo.pynow inspects deep paths and dispatches file requests after validating path segments. Files resolve relative to the dojo tree only when the match is unique. Safe extensions are rendered appropriately; everything else streams viasend_file.dojo_theme/templates/text_file.htmlrenders textual assets with dojo/module context headers.Files Changed
dojo_plugin/pages/dojo.py: Added file-resolution helpers, sanitized segment checking, and expandedview_dojo_pathrouting.dojo_theme/templates/text_file.html: New template for text-based assets.UNDER CONSTRUCTION