Fix file parent again

This commit is contained in:
Jackzie 2025-04-15 16:07:06 -05:00
parent 5214ea543c
commit ab1b808b13
2 changed files with 10 additions and 3 deletions

View file

@ -45,7 +45,12 @@ pub async fn list_library_files(route: &Route, libraries: &State<Arc<Mutex<Libra
// TODO:
// parent
let parent = path.clone();
let mut parent = path.to_string_lossy();
if parent == "/" {
parent = "".into();
} else if parent != "" {
parent = format!("{}/", parent).into();
}
let mut seg_path = PathBuf::new();
let segments: Vec<PathSegmentPiece> = path.iter()
.map(|segment| {

View file

@ -29,6 +29,8 @@
</div>
</div>
</div>
<div class="code">
</div>
<hr class="my-2">
<table class="table is-fullwidth">
<thead>
@ -65,10 +67,10 @@
</td>
<td class="filecell-label pl-4">
{{#if (eq type "folder")}}
<a href="{{../parent}}/{{ path }}">{{ path }}/</a>
<a href="{{../parent}}{{ path }}">{{ path }}/</a>
{{/if}}
{{#if (eq type "file") }}
<a target="_blank" href="/file/{{../library.id}}/{{../parent}}/{{ path }}">{{ path }}</a>
<a target="_blank" href="/file/{{../library.id}}/{{../parent}}{{ path }}">{{ path }}</a>
{{/if}}
</td>
<td>{{ bytes size }}</td>