Skip to content

Commit 085c21c

Browse files
committed
fix: content-length of absolute custom DRP path for Common and Extended Data Retrievers
1 parent 40eb465 commit 085c21c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CommonDataRetriever.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ public function retrieveField($field_name, $value= null) {
9191
$requestTarget= DataRetrievalPolicyHelper::getDataRetrievalPolicyParameter(static::$retrievalPolicies, DRP::DRP_CONTENT_LENGTH_RETRIEVAL);
9292
$basepath= str_replace(basename($_SERVER["SCRIPT_FILENAME"]), "", $_SERVER['SCRIPT_FILENAME']);
9393
if (FileLogWriterHelper::isAbsolutePath($requestTarget)) {
94-
$scriptBaseRel= str_replace($_SERVER['DOCUMENT_ROOT'], "", $basepath);
95-
$basepath= str_replace($scriptBaseRel, "", $basepath);
94+
$requestpath= $basepath.substr($requestTarget, 1, strlen($requestTarget));
95+
} else {
96+
$requestpath= $basepath.$requestTarget;
9697
}
97-
$requestpath= $basepath.$requestTarget;
9898
if (file_exists($requestpath)) {
9999
$value= filesize($requestpath);
100100
} else {

ExtendedDataRetriever.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ public function retrieveField($field_name, $value= null) {
118118
$requestTarget= DataRetrievalPolicyHelper::getDataRetrievalPolicyParameter(static::$retrievalPolicies, DRP::DRP_CONTENT_LENGTH_RETRIEVAL);
119119
$basepath= str_replace(basename($_SERVER["SCRIPT_FILENAME"]), "", $_SERVER['SCRIPT_FILENAME']);
120120
if (FileLogWriterHelper::isAbsolutePath($requestTarget)) {
121-
$scriptBaseRel= str_replace($_SERVER['DOCUMENT_ROOT'], "", $basepath);
122-
$basepath= str_replace($scriptBaseRel, "", $basepath);
121+
$requestpath= $basepath.substr($requestTarget, 1, strlen($requestTarget));
122+
} else {
123+
$requestpath= $basepath.$requestTarget;
123124
}
124-
$requestpath= $basepath.$requestTarget;
125125
if (file_exists($requestpath)) {
126126
$value= filesize($requestpath);
127127
} else {

0 commit comments

Comments
 (0)