aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2025-01-04 19:43:48 +0100
committerGravatar GitHub <noreply@github.com> 2025-01-04 19:43:48 +0100
commit1d02214e1253b86622262988ad7ecce1f5647006 (patch)
treefe57a4c90ecb6f88c9683f59846d3fb53d0e11e1 /lib
parent48cb7d71ed982e6b4145a825eb7c5579b9023999 (diff)
downloadrss-bridge-1d02214e1253b86622262988ad7ecce1f5647006.tar.gz
rss-bridge-1d02214e1253b86622262988ad7ecce1f5647006.tar.zst
rss-bridge-1d02214e1253b86622262988ad7ecce1f5647006.zip
feat: extract simple_html_dom max_file_size to config (#4395)
Diffstat (limited to 'lib')
-rw-r--r--lib/bootstrap.php4
-rw-r--r--lib/simplehtmldom/simple_html_dom.php5
2 files changed, 3 insertions, 6 deletions
diff --git a/lib/bootstrap.php b/lib/bootstrap.php
index 36b13e19..8a7c62a1 100644
--- a/lib/bootstrap.php
+++ b/lib/bootstrap.php
@@ -7,10 +7,6 @@ if (is_file(__DIR__ . '/../vendor/autoload.php')) {
const PATH_LIB_CACHES = __DIR__ . '/../caches/';
const PATH_CACHE = __DIR__ . '/../cache/';
-// Allow larger files for simple_html_dom
-// todo: extract to config (if possible)
-const MAX_FILE_SIZE = 10000000;
-
// Files
$files = [
__DIR__ . '/../lib/html.php',
diff --git a/lib/simplehtmldom/simple_html_dom.php b/lib/simplehtmldom/simple_html_dom.php
index 170f6fb0..e8b3a727 100644
--- a/lib/simplehtmldom/simple_html_dom.php
+++ b/lib/simplehtmldom/simple_html_dom.php
@@ -114,8 +114,9 @@ function str_get_html(
if (empty($str)) {
throw new \Exception('Refusing to parse empty string input');
}
- if (strlen($str) > MAX_FILE_SIZE) {
- throw new \Exception('Refusing to parse too big input');
+
+ if (strlen($str) > Configuration::getConfig('system', 'max_file_size')) {
+ throw new \Exception('simple_html_dom: Refusing to parse too big input: ' . strlen($str));
}
return $dom->load($str, $lowercase, $stripRN);