A free, self-hostable news aggregator…
Fix encoding of themes (#7565)
Alexandre Alapetite25f57beb90e1
diff --git a/app/Models/Themes.php b/app/Models/Themes.phpindex 2b5bff2f7..ef44b0b75 100644--- a/app/Models/Themes.php+++ b/app/Models/Themes.php@@ -20,19 +20,21 @@ class FreshRSS_Themes extends Minz_Model {$themes_list = self::getList();$list = [];foreach ($themes_list as $theme_dir) {- $theme = self::get_infos($theme_dir);+ $theme_id = rawurlencode($theme_dir);+ $theme = self::get_infos($theme_id);if (is_array($theme) && trim($theme['name']) !== '') {- $list[$theme_dir] = $theme;+ $list[$theme_id] = $theme;}}return $list;}/**+ * @param string $theme_id is the rawurlencode'd theme directory name* @return false|array{id:string,name:string,author:string,description:string,version:float|string,files:array<string>,theme-color?:string|array{dark?:string,light?:string,default?:string}}*/public static function get_infos(string $theme_id): array|false {- $theme_dir = PUBLIC_PATH . self::$themesUrl . $theme_id;+ $theme_dir = PUBLIC_PATH . self::$themesUrl . rawurldecode($theme_id);if (is_dir($theme_dir)) {$json_filename = $theme_dir . '/metadata.json';if (file_exists($json_filename)) {@@ -55,6 +57,7 @@ class FreshRSS_Themes extends Minz_Model {'default' => is_string($res['theme-color']['default'] ?? null) ? $res['theme-color']['default'] : '',];}+ $result = Minz_Helper::htmlspecialchars_utf8($result);return $result;}}