Просмотр исходного кода

Merge pull request #1888 from marouane-hassine/fix/dead-path-validation-guard

fix: run PATH trailing-separator check instead of dead guard
El RIDO 1 неделя назад
Родитель
Сommit
b6f0cb2632
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 0
      CHANGELOG.md
  2. 1 1
      lib/Controller.php

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@
 * CHANGED: Switch to PHP native JsonException type
 * FIXED: Gracefully handle YOURLS replies with a 200 status code but no shorturl, instead of raising a TypeError
 * FIXED: Return "Invalid data." instead of HTTP 500 on malformed v2 JSON payloads (#1883)
+* FIXED: Dead PATH validation guard in Controller, the check for a missing trailing directory separator never ran (#1887)
 
 ## 2.0.5 (2026-07-11)
 * CHANGED: Show OS-specific copy hotkey hint (Cmd+c on Mac, Ctrl+c on others) (#1506)

+ 1 - 1
lib/Controller.php

@@ -127,7 +127,7 @@ class Controller
             error_log(I18n::_('%s requires php %s or above to work. Sorry.', I18n::_('PrivateBin'), self::MIN_PHP_VERSION));
             return;
         }
-        if (strlen(PATH) < 0 && substr(PATH, -1) !== DIRECTORY_SEPARATOR) {
+        if (strlen(PATH) > 0 && substr(PATH, -1) !== DIRECTORY_SEPARATOR) {
             error_log(I18n::_('%s requires the PATH to end in a "%s". Please update the PATH in your index.php.', I18n::_('PrivateBin'), DIRECTORY_SEPARATOR));
             return;
         }