diff options
| author | kj_sh604 <43.splash@gmail.com> | 2026-03-08 20:06:32 -0400 |
|---|---|---|
| committer | kj_sh604 <43.splash@gmail.com> | 2026-03-08 20:06:45 -0400 |
| commit | d29192b67a4e1f88462d46d8608df98bc978da45 (patch) | |
| tree | 8e6aebea759d5fdfe8e84a6054321a3b0fc34276 | |
| parent | fd01077b3f163cbe05be2cfeacdc45d3d060b8a5 (diff) | |
refactor: more friendly font lookup for most server set-ups
| -rw-r--r-- | src/font.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/font.php b/src/font.php index de39569..d12ceb8 100644 --- a/src/font.php +++ b/src/font.php @@ -15,10 +15,16 @@ if ($file === false || !file_exists($file)) { $real = realpath($file); $allowed = ['/usr/share/fonts', '/usr/local/share/fonts']; -$ok = false; + +foreach (glob('/home/*', GLOB_ONLYDIR) as $home) { + $allowed[] = $home . '/.local/share/fonts'; + $allowed[] = $home . '/.fonts'; +} + +$ok = false; foreach ($allowed as $dir) { - if (str_starts_with($real, $dir)) { + if (str_starts_with($real, realpath($dir) ?: $dir)) { $ok = true; break; } |
