aboutsummaryrefslogtreecommitdiff
path: root/p/ext.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-03-22 16:31:20 +0100
committerGravatar GitHub <noreply@github.com> 2020-03-22 16:31:20 +0100
commitcd49e9819bea35a4db05e3e76910b739898c2219 (patch)
tree437b36b429357f90d2a168d4ba2ae016708cc54d /p/ext.php
parentc03e097dae7e7a2026bde7ef96e5f05b139d758d (diff)
New core-extensions to allow Docker volumes for third-party extensions (#2837)
* New core-extensions to allow Docker volumes for third-party extensions #Fix https://github.com/FreshRSS/FreshRSS/issues/2650 Split our extensions directory into two: 1) Core extensions shipped with FreshRSS in ./lib/core-extensions/ 2) Third-party extensions modified by end-users in ./extensions/ which can easily be mounted as a Docker volume * Example of Docker Compose with extensions * Back-compatibility + fix array merge bug
Diffstat (limited to 'p/ext.php')
-rw-r--r--p/ext.php28
1 files changed, 16 insertions, 12 deletions
diff --git a/p/ext.php b/p/ext.php
index 3035aae7d..f3b7b6a9e 100644
--- a/p/ext.php
+++ b/p/ext.php
@@ -7,19 +7,9 @@ if (!isset($_GET['f']) ||
require(__DIR__ . '/../constants.php');
-/**
- * Check if a file can be served by ext.php. A valid file is under a
- * EXTENSIONS_PATH/extension_name/static/ directory.
- *
- * You should sanitize path by using the realpath() function.
- *
- * @param $path the path to the file we want to serve.
- * @return true if it can be served, false else.
- *
- */
-function is_valid_path($path) {
+function is_valid_path_extension($path, $extensionPath) {
// It must be under the extension path.
- $real_ext_path = realpath(EXTENSIONS_PATH);
+ $real_ext_path = realpath($extensionPath);
//Windows compatibility
$real_ext_path = str_replace('\\', '/', $real_ext_path);
@@ -40,6 +30,20 @@ function is_valid_path($path) {
return true;
}
+/**
+ * Check if a file can be served by ext.php. A valid file is under a
+ * CORE_EXTENSIONS_PATH/extension_name/static/ or THIRDPARTY_EXTENSIONS_PATH/extension_name/static/ directory.
+ *
+ * You should sanitize path by using the realpath() function.
+ *
+ * @param $path the path to the file we want to serve.
+ * @return true if it can be served, false otherwise.
+ *
+ */
+function is_valid_path($path) {
+ return is_valid_path_extension($path, CORE_EXTENSIONS_PATH) || is_valid_path_extension($path, THIRDPARTY_EXTENSIONS_PATH);
+}
+
$file_name = urldecode($_GET['f']);
$file_type = $_GET['t'];