1
0
Fork 0

Code changes for #10020:

Added ability to set chmod (default: 0640) for "proxified" files (downloaded to
/proxy/ directory). This allows customization, e.g. if people want 0600 instead
without changing the code.

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2021-03-09 21:37:14 +01:00
parent bcfe0933da
commit 736045c67d
2 changed files with 10 additions and 2 deletions

View file

@ -131,7 +131,9 @@ class Proxy extends BaseModule
// Store original image // Store original image
if ($direct_cache) { if ($direct_cache) {
// direct cache , store under ./proxy/ // direct cache , store under ./proxy/
file_put_contents($basepath . '/proxy/' . ProxyUtils::proxifyUrl($request['url'], true), $image->asString()); $filename = $basepath . '/proxy/' . ProxyUtils::proxifyUrl($request['url'], true)
file_put_contents($filename, $image->asString());
chmod($filename, DI::config()->get('system', 'proxy_file_chmod', 0640));
} elseif($cachefile !== '') { } elseif($cachefile !== '') {
// cache file // cache file
file_put_contents($cachefile, $image->asString()); file_put_contents($cachefile, $image->asString());
@ -149,7 +151,9 @@ class Proxy extends BaseModule
// Store scaled image // Store scaled image
if ($direct_cache && $request['sizetype'] != '') { if ($direct_cache && $request['sizetype'] != '') {
file_put_contents($basepath . '/proxy/' . ProxyUtils::proxifyUrl($request['url'], true) . $request['sizetype'], $image->asString()); $filename = $basepath . '/proxy/' . ProxyUtils::proxifyUrl($request['url'], true) . $request['sizetype'];
file_put_contents($filename, $image->asString());
chmod($filename, DI::config()->get('system', 'proxy_file_chmod', 0640));
} }
self::responseImageHttpCache($image); self::responseImageHttpCache($image);

View file

@ -570,6 +570,10 @@ return [
// xrd_timeout (Integer) // xrd_timeout (Integer)
// Timeout in seconds for fetching the XRD links. // Timeout in seconds for fetching the XRD links.
'xrd_timeout' => 20, 'xrd_timeout' => 20,
// proxy_file_chmod (Integer)
// Access rights for downloaded files in /proxy/ directory
'proxy_file_chmod' => 0640,
], ],
'experimental' => [ 'experimental' => [
// exp_themes (Boolean) // exp_themes (Boolean)