Closed tony closed 7 months ago
This is anecdotal, but CloudFront wants paths to end in a slash:
https://libvcs.git-pull.com/api/source/libvcs.hg/#libvcs.hg.MercurialRepo
https://libvcs.git-pull.com/api/source/libvcs.hg#libvcs.hg.MercurialRepo
Thoughts on adding this as a default behavior? Setting?
diff --git a/mkapi/core/postprocess.py b/mkapi/core/postprocess.py index 959aa77..bab3313 100644 --- a/mkapi/core/postprocess.py +++ b/mkapi/core/postprocess.py @@ -11,7 +11,7 @@ def sourcelink(object: Object) -> str: link = f'<span id="{object.id}"></span>' else: link = "" - link += f'<a class="mkapi-src-link" href="../source/{object.module}' + link += f'<a class="mkapi-src-link" href="../source/{object.module}/' link += f'#{object.id}" title="Source for {object.id}"></></a>' return link diff --git a/mkapi/templates/object.jinja2 b/mkapi/templates/object.jinja2 index da1ef7f..f7a0a11 100644 --- a/mkapi/templates/object.jinja2 +++ b/mkapi/templates/object.jinja2 @@ -11,7 +11,7 @@ </div> {% if 'sourcelink' in filters or 'link' in filters or 'apilink' in filters -%} <div class="mkapi-src-link"> - <a class="mkapi-src-link" href="../source/{{ object.module }}#{{ object.id }}" title="Source for {{ object.id }}"></></a> + <a class="mkapi-src-link" href="../source/{{ object.module }}/#{{ object.id }}" title="Source for {{ object.id }}"></></a> </div> {%- endif %} </div>
Currently I hard-code this in a forked package since I feel its too specialized (and I'm not sure what other static file hosts use)
Thank you for reporting this issue. Adding a trailing slash is correct. I updated these files + mkapi/core/code.py.
mkapi/core/code.py
This is anecdotal, but CloudFront wants paths to end in a slash:
https://libvcs.git-pull.com/api/source/libvcs.hg/#libvcs.hg.MercurialRepo
https://libvcs.git-pull.com/api/source/libvcs.hg#libvcs.hg.MercurialRepo
Thoughts on adding this as a default behavior? Setting?
Currently I hard-code this in a forked package since I feel its too specialized (and I'm not sure what other static file hosts use)