Skip to content

Commit

Permalink
#111 DICOM Viewer displays black screen. Previews are OK. (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayselafsar authored May 25, 2024
1 parent 196da51 commit 9ca0079
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/Controller/DisplayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ private function cleanDICOMTagValue($value) {
return $value;
}

private function convertToUTF8($d) {
if (is_array($d)) {
foreach ($d as $k => $v) {
$d[$k] = $this->convertToUTF8($v);
}
} else if (is_string($d)) {
return utf8_encode($d);
}
return $d;
}

private function getAllDICOMFilesInFolder($parentPathToRemove, $folderNode, $isOpenNoExtension) {
$filepaths = array();
$nodes = $folderNode->getDirectoryListing();
Expand Down Expand Up @@ -472,6 +483,7 @@ public function getDICOMJson(): JSONResponse {
$dicomParentFullPath = $this->dataFolder.'/'.$userId.'/files';
$downloadUrlPrefix = 'remote.php/dav/files/'.$currentUserId;
$dicomJson = $this->generateDICOMJson($dicomFilePaths, $selectedFileFullPath, $dicomParentFullPath, $currentUserPathToFile, $downloadUrlPrefix, false, false);
$dicomJson = $this->convertToUTF8($dicomJson);
$response = new JSONResponse($dicomJson);
return $response;
}
Expand Down Expand Up @@ -519,6 +531,7 @@ public function getPublicDICOMJson(): JSONResponse {
$downloadUrlPrefix = $this->getNextcloudBasePath().'/s/'.$shareToken.'/download';
$dicomJson = $this->generateDICOMJson($dicomFilePaths, $selectedFileFullPath, $dicomParentFullPath, null, $downloadUrlPrefix, true, $singlePublicFileDownload);

$dicomJson = $this->convertToUTF8($dicomJson);
$response = new JSONResponse($dicomJson);
return $response;
} catch (Exception $exception) {
Expand Down

0 comments on commit 9ca0079

Please sign in to comment.