Fix error on binary files
gitile/pages.scm
99 | 99 | (a (@ (href "/" ,repository-name "/raw/" ,(or ref "-") | |
100 | 100 | "/" ,path)) | |
101 | 101 | (img (@ (src "/images/file-type-3.svg")))))) | |
102 | - | ,(let ((content (utf8->string (get-file-content repo path #:ref ref)))) | |
103 | - | (if (string-suffix? ".md" path) | |
104 | - | `(article (@ (class "formatted-file-content")) | |
105 | - | ,(improve-content (commonmark->sxml content))) | |
106 | - | (display-code content path))))) | |
102 | + | ,(with-exception-handler | |
103 | + | (lambda (exn) | |
104 | + | `(pre "Binary data")) | |
105 | + | (lambda () | |
106 | + | (let ((content (utf8->string (get-file-content repo path #:ref ref)))) | |
107 | + | (if (string-suffix? ".md" path) | |
108 | + | `(article (@ (class "formatted-file-content")) | |
109 | + | ,(improve-content (commonmark->sxml content))) | |
110 | + | (display-code content path)))) | |
111 | + | #:unwind? #t))) | |
107 | 112 | ||
108 | 113 | (define* (project-files repository-name repo #:key (ref "-") (path '())) | |
109 | 114 | (let* ((ref (if (equal? ref "-") #f ref)) |