From e52a00fad93831dfd7cf6fe9cdec8e1aaa3c2ccb Mon Sep 17 00:00:00 2001
From: navewindre <boneyaard@gmail.com>
Date: Tue, 11 Nov 2025 08:57:25 +0100
Subject: fix

---
 web/src/pkg.tsx | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

(limited to 'web/src/pkg.tsx')

diff --git a/web/src/pkg.tsx b/web/src/pkg.tsx
index 60a51bb..6705982 100644
--- a/web/src/pkg.tsx
+++ b/web/src/pkg.tsx
@@ -13,18 +13,17 @@ function downloadFile( file: string ) {
 
 function urlForHref( href: string, isdir: boolean ) {
   const url = new URL( window.location.href );
+  let path = url.pathname;
   if( isdir ) {
-    const path = url.pathname;
     if( path.endsWith( '/' ) ) {
       return path + href;
     }
     return path + "/" + href;
   }
 
-  let searchParams = url.searchParams.toString();
-  searchParams = searchParams.slice( searchParams.indexOf( '/' ) );
-  searchParams = searchParams.slice( searchParams.indexOf( '/' ) );
-  return "https://networkheaven.net/pkgs" + searchParams + "/" + href;
+  path = path.slice( path.indexOf( '/pkgs' ) + 5 );
+  if( path.endsWith( '/' ) )
+    return "https://networkheaven.net/pkgs" + path + "" + href;
 }
 
 interface PkgEntry {
@@ -80,7 +79,6 @@ async function getEntries(): Promise<PkgEntry[]> {
   const pre = pkgBody.find( "pre" )[0].innerText;
 
   const ret = [];
-  console.log( url.pathname );
   if( !url.pathname.endsWith( "/pkg/" ) && !url.pathname.endsWith( "/pkg" ) ) {
      ret.push({
       name: '../',
@@ -97,7 +95,6 @@ async function getEntries(): Promise<PkgEntry[]> {
       continue;
 
     const entry = entryFromLine( line );
-    console.log( entry );
     if( entry )
       ret.push( entry );
   }
@@ -114,16 +111,18 @@ function back() {
 }
 
 function PackageEntry( props: any ) {
-  console.log( props );
   const entry = props.entry as PkgEntry;
-  console.log( urlForHref( entry.name, entry.isdir ) );
   return <tr>
     <td>
       { entry.name == "../" &&
       <a href='#' onclick={ () => back() } class="package-entry-link">
         ../
       </a> }
-      { entry.name != "../" &&
+      { entry.name != "../" && !entry.isdir &&
+      <a href={urlForHref( entry.name, entry.isdir )} class="package-entry-link">
+        {entry.name}
+      </a> }
+      { entry.name != "../" && entry.isdir &&
       <a href='#' onclick={ () => JSX.navigate( urlForHref( entry.name, entry.isdir ) ) } class="package-entry-link">
         {entry.name}
       </a> }
-- 
cgit v1.2.3

