Commit 3a0cf660eb3fd516d447644c292767c1a5d58d81

Thomas de Grivel 2024-09-25T19:21:50

wip fx

diff --git a/.gitignore b/.gitignore
index 1c8ae46..2c5b305 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,6 +52,7 @@ lib/kc3/0.1/markdown.so
 lib/kc3/0.1/socket.so
 .libs/
 *.lo
+*.log
 macos/kc3-v*
 /misc/fact_w
 /misc/http_request
diff --git a/httpd/fx/app/views/fx_view.kc3 b/httpd/fx/app/views/fx_view.kc3
index e363f8a..ba695bd 100644
--- a/httpd/fx/app/views/fx_view.kc3
+++ b/httpd/fx/app/views/fx_view.kc3
@@ -55,9 +55,11 @@ defmodule FXView do
             end
             """<pre class="#{size}">#{HTML.escape(file)}</pre>"""
           else
-            file = system(["hexdump", "-C", path])
-            if (size == :small && Str.size(file) > 77) do
-              file = Str.slice(file, 0, 77) + "..."
+            file = if (size == :small) do
+              system(["sh", "-c",
+                      "hexdump -C #{Sh.escape(path)} | head -n 4"])
+            else
+              system(["hexdump", "-C", path])
             end
             """<pre class="#{size}">#{HTML.escape(file)}</pre>"""
           end