Skip to content

Commit

Permalink
Mangled path fax send (openemr#7515)
Browse files Browse the repository at this point in the history
normalize file path from document controller for fax send

(cherry picked from commit 0cfa65e)
  • Loading branch information
sjpadgett committed Jun 22, 2024
1 parent d1cb803 commit 1457111
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function sendFax(): string
// needed args
$isContent = $this->getRequest('isContent');
$file = $this->getRequest('file');
$docId = $this->getRequest('docId');
$docId = $this->getRequest('docid');
$phone = $this->formatPhone($this->getRequest('phone'));
$isDocuments = (int)$this->getRequest('isDocuments');
$email = $this->getRequest('email');
Expand All @@ -192,8 +192,14 @@ public function sendFax(): string
$tag = $user['username'];

if (empty($isContent)) {
$file = str_replace(["file://", "\\"], ['', "/"], realpath($file));
if (!$file) {
if (str_starts_with($file, 'file://')) {
// Remove the "file://" prefix
$file = substr($file, 7);
}
$realPath = realpath($file);
if ($realPath !== false) {
$file = str_replace("\\", "/", $realPath);
} else {
return xlt('Error: No content');
}
}
Expand Down Expand Up @@ -658,7 +664,7 @@ public function setFaxDeleted($jobId): bool
public function chartDocument(): string
{
$pid = $this->getRequest('pid');
$docId = $this->getRequest('docId');
$docId = $this->getRequest('docid') ?? $this->getRequest('docId');
$fileName = $this->getRequest('file_name');
$result = $this->chartFaxDocument($pid, $docId, $fileName);

Expand Down

0 comments on commit 1457111

Please sign in to comment.