Move WebDAV derivative test source to Piwigo upload area

This commit is contained in:
Terranom674
2026-08-20 14:31:28 +02:00
parent 1e57e6d300
commit 7ef6c24db4

View File

@@ -54,7 +54,7 @@ function bratonien_tools_webdav_derivative_test_source_info($image_id, array $im
$resolved = realpath($absolute);
if ($resolved === false) return null;
$normalized = str_replace('\\\\', '/', $resolved);
$normalized = str_replace('\\', '/', $resolved);
if (!preg_match('#/nc-webdav-source/connection-([0-9]+)/root-([0-9]+)/(.*)$#', $normalized, $match))
{
return null;
@@ -300,7 +300,8 @@ if (!$source)
bratonien_tools_webdav_derivative_test_abort(404, 'Keine WebDAV-Quelle fuer dieses Bild gefunden.');
}
$test_rel_dir = trim(PWG_DERIVATIVE_DIR, '/').'/bratonien-webdav-test';
$upload_dir = rtrim((string)($GLOBALS['conf']['upload_dir'] ?? './upload'), '/');
$test_rel_dir = $upload_dir.'/bratonien-webdav-test';
$test_root = PHPWG_ROOT_PATH.$test_rel_dir;
if (!is_dir($test_root) && !@mkdir($test_root, 0755, true))
{
@@ -328,7 +329,7 @@ if (!in_array($extension, array('jpg', 'jpeg', 'png', 'gif', 'webp'), true))
$token = getmypid().'-'.bin2hex(random_bytes(6));
$source_filename = 'source-'.$image_id.'-'.$token.'.'.$extension;
$source_path = $test_root.'/'.$source_filename;
$source_rel = './'.$test_rel_dir.'/'.$source_filename;
$source_rel = $test_rel_dir.'/'.$source_filename;
$temp_image_id = 0;
$derivative_path = '';
$cleaned = false;