fix(preview.html): correct back to parent directory link

Updated the "Back to Parent Directory" link to handle file paths
starting with a slash. This adjustment ensures the URL is properly
constructed, preventing broken links and enhancing navigation
usability in the preview view.
This commit is contained in:
Kumi 2024-06-19 09:33:31 +02:00
parent 755719daec
commit 74e6a1310b
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -7,7 +7,7 @@
<div class="col-md-12">
<h1>{{ owner }}/{{ repo }} - <small>{{ file_path }}</small></h1>
<div class="mb-3">
<a href="/{{ owner }}/{{ repo }}/tree/main/{{ file_path.rsplit('/', 1)[0] }}">
<a href="/{{ owner }}/{{ repo }}/tree/main/{{ ("/" + file_path).rsplit('/', 1)[0].lstrip("/") }}">
<img class="icon" src="/assets/dist/icons/folder.svg" alt="Back to Parent Directory"> Back to Parent Directory
</a>
</div>