From 7ed16a539735021893f1780af49a5fc726e725a5 Mon Sep 17 00:00:00 2001 From: jabuxas Date: Wed, 16 Oct 2024 23:34:08 -0300 Subject: [PATCH] feat: redirect to another link if file is not supported --- file_display.go | 4 ++-- templates/files.html | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/file_display.go b/file_display.go index 612abb1..3be0ba7 100644 --- a/file_display.go +++ b/file_display.go @@ -29,7 +29,7 @@ var extensions = map[string]string{ ".log": "text", ".txt": "text", ".csv": "text", ".json": "text", ".env": "text", ".sum": "text", ".gitignore": "text", ".dockerfile": "text", ".Makefile": "text", - ".rst": "text", + ".rst": "text", ".el": "text", } func DisplayFile(app *Application, file string, w http.ResponseWriter) { @@ -59,5 +59,5 @@ func getType(file string) string { if fileType, exists := extensions[extension]; exists { return fileType } - return "text" + return "unknown" } diff --git a/templates/files.html b/templates/files.html index 257b337..f38a0db 100644 --- a/templates/files.html +++ b/templates/files.html @@ -187,6 +187,11 @@ border-radius: 10px; border: 3px solid #2e2e2e; } + + a { + color: #0288d1; + text-decoration: none; + } @@ -204,6 +209,11 @@ Your browser does not support the video tag. + {{else}} +

+ Couldn't detect file from extension, visit + this link to see/download your file. +

{{end}}