diff --git a/dir-index.html b/dir-index.html index 342809e11578bffb52d6751dd73e210cac1ff6da..c4da35a76f47621496f9cd0fa0df89446a87e71c 100644 --- a/dir-index.html +++ b/dir-index.html @@ -18,7 +18,7 @@ {{ .Path }} @@ -81,11 +81,10 @@ {{ .Name }} - + {{ if .Hash }} - - {{ slice .Hash 0 40 }} - {{ slice .Hash 40 }} + + {{ .ShortHash }} {{ end }} diff --git a/test/main.go b/test/main.go index 208b2ad54e11769618e7d922026ffea9f690643c..625456ed92520d09e83cabf77ef08a0792e78074 100644 --- a/test/main.go +++ b/test/main.go @@ -25,6 +25,7 @@ type directoryItem struct { Name string Path string Hash string + ShortHash string } type breadcrumb struct { @@ -39,11 +40,13 @@ var testData = listingTemplateData{ Name: "short-film.mov", Path: testPath + "/short-film.mov", Hash: "QmQuxBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", + ShortHash: "QmQu\u2026xDu7", }, { Size: "1 KiB", Name: "this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt", Path: testPath + "/this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt", Hash: "QmquXbaRQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", + ShortHash: "Qmqu\u2026xDu7", }}, Size: "25 MiB", Path: testPath,