Skip to content

Commit c124512

Browse files
committed
Fixes
1 parent 6bc9a75 commit c124512

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/Template.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ private function initTwig(): Environment {
7373
$twig->addFunction(new TwigFunction('link', Http::queryString(...), ['is_safe' => ['html']]));
7474
$twig->addFunction(new TwigFunction('get', Http::get(...)));
7575
$twig->addFunction(new TwigFunction('config', Config::get(...)));
76+
$twig->addFunction(new TwigFunction('is_numeric', is_numeric(...)));
7677

7778
$twig->addFilter(new TwigFilter('space', static function (?string $value, bool $right = false): string {
7879
$right_side = $right ? $value.' ' : ' '.$value;

templates/partials/table_view.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
{% elseif item_key starts with 'timediff_' and item is not empty %}
5555
<span title="{{ item|time }}">{{- item|timediff -}}</span>
5656
{% elseif item_key == 'ttl' and item is not empty %}
57-
<span title="{{ item|seconds }}">{{- item -}}</span>
57+
<span title="{{ is_numeric(item) ? item|seconds : item }}">{{- item -}}</span>
5858
{% elseif item_key starts with 'bytes_' %}
5959
{{- item|bytes -}}
6060
{% else %}

templates/partials/tree_view.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
{{- kitem|time -}}
4747
{% elseif item_key starts with 'timediff_' and kitem is not empty %}
4848
<span title="{{ kitem|time }}">{{- kitem|timediff -}}</span>
49-
{% elseif item_key == 'ttl' and item is not empty %}
50-
<span title="{{ item|seconds }}">{{- item -}}</span>
49+
{% elseif item_key == 'ttl' and kitem is not empty %}
50+
<span title="{{ is_numeric(kitem) ? kitem|seconds : kitem }}">{{- kitem -}}</span>
5151
{% elseif item_key starts with 'bytes_' %}
5252
<span class="file-size" data-bytes="{{ kitem }}">{{- kitem|bytes -}}</span>
5353
{% else %}

0 commit comments

Comments
 (0)