diff --git a/src/handlers/strategies/directoryListing.ts b/src/handlers/strategies/directoryListing.ts index 34a7933..66a69a8 100644 --- a/src/handlers/strategies/directoryListing.ts +++ b/src/handlers/strategies/directoryListing.ts @@ -35,17 +35,7 @@ export function renderDirectoryListing( env: Env ): Response { // Holds the contents of the listing (directories and files) - const tableElements = []; - - // There shouldn't really be a case where we're listing the root - // directory (/) when this is deployed, so always add the option - // to go up a directory - tableElements.push({ - href: '../', - name: '../', - lastModified: '-', - size: '-', - }); + const tableElements: object[] = []; const urlPathname = `${url.pathname}${url.pathname.endsWith('/') ? '' : '/'}`; diff --git a/src/templates/directoryListing.hbs b/src/templates/directoryListing.hbs index b9a7e4c..87d6356 100644 --- a/src/templates/directoryListing.hbs +++ b/src/templates/directoryListing.hbs @@ -1,31 +1,9 @@ - - Index of {{pathname}} - - - - - -

Index of {{pathname}}

- - - - - - - {{#each entries}} - - - - - - {{/each}} -
FilenameModifiedSize
{{name}}{{lastModified}}{{size}}
- +Index of {{pathname}} + +

Index of {{pathname}}


../
+{{#each entries}} +{{name}} {{lastModified}} {{size}}
+{{/each}} +

\ No newline at end of file diff --git a/src/templates/directoryListing.out.js b/src/templates/directoryListing.out.js index ec461bf..da57739 100644 --- a/src/templates/directoryListing.out.js +++ b/src/templates/directoryListing.out.js @@ -1 +1 @@ -export default{1:function(t,e,n,l,a){var o,i=t.strict,r=t.lambda;return""+(null!=(o=r(i(e,"name",{start:{line:24,column:35},end:{line:24,column:39}}),e))?o:"")+""+(null!=(o=r(i(e,"lastModified",{start:{line:25,column:16},end:{line:25,column:28}}),e))?o:"")+""+(null!=(o=r(i(e,"size",{start:{line:26,column:16},end:{line:26,column:20}}),e))?o:"")+""},compiler:[8,">= 4.3.0"],main:function(t,e,n,l,a){var o,i=t.strict,r=t.lambda,c=t.lookupProperty||function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]};return"Index of "+(null!=(o=r(i(e,"pathname",{start:{line:3,column:22},end:{line:3,column:30}}),e))?o:"")+"

Index of "+(null!=(o=r(i(e,"pathname",{start:{line:15,column:19},end:{line:15,column:27}}),e))?o:"")+"

"+(null!=(o=c(n,"each").call(null!=e?e:t.nullContext||{},c(e,"entries"),{name:"each",hash:{},fn:t.program(1,a,0),inverse:t.noop,data:a,loc:{start:{line:22,column:6},end:{line:28,column:15}}}))?o:"")+"
FilenameModifiedSize
"},useData:!0}; +export default{1:function(n,l,e,t,a){var r,o=n.strict,u=n.lambda;return''+(null!=(r=u(o(l,"name",{start:{line:6,column:21},end:{line:6,column:25}}),l))?r:"")+" "+(null!=(r=u(o(l,"lastModified",{start:{line:6,column:71},end:{line:6,column:83}}),l))?r:"")+" "+(null!=(r=u(o(l,"size",{start:{line:6,column:106},end:{line:6,column:110}}),l))?r:"")+"
"},compiler:[8,">= 4.3.0"],main:function(n,l,e,t,a){var r,o=n.strict,u=n.lambda,i=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return"Index of "+(null!=(r=u(o(l,"pathname",{start:{line:2,column:24},end:{line:2,column:32}}),l))?r:"")+"

Index of "+(null!=(r=u(o(l,"pathname",{start:{line:4,column:15},end:{line:4,column:23}}),l))?r:"")+'


../
'+(null!=(r=i(e,"each").call(null!=l?l:n.nullContext||{},i(l,"entries"),{name:"each",hash:{},fn:n.program(1,a,0),inverse:n.noop,data:a,loc:{start:{line:5,column:0},end:{line:7,column:9}}}))?r:"")+"

"},useData:!0};