]> _ Git - fluidbook-toolbox.git/commitdiff
#7634 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 29 Jul 2025 15:14:42 +0000 (17:14 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 29 Jul 2025 15:14:42 +0000 (17:14 +0200)
app/Fluidbook/Farm.php
app/Models/FluidbookPublication.php

index b0a0986c36e79e6b66ab49b67b1163570b6a0f9b..954cd1f47f9a2636abecefe08dedab4c7336b469 100644 (file)
@@ -287,7 +287,7 @@ class Farm
             return self::_getFile(
                 ['operation' => 'extractmarkdown',
                     'pdf' => $pdf,
-                    'out' => $out], 0, false);
+                    'out' => $out], 0, $out . '/docling/p1.md');
         });
     }
 
@@ -323,16 +323,20 @@ class Farm
             return false;
         }
 
-        if ($checkOutput) {
-            $output = trim($output);
+        if (is_bool($checkOutput)) {
+            if ($checkOutput) {
+                $output = trim($output);
 
-            if (file_exists($output)) {
-                $res = $output;
+                if (file_exists($output)) {
+                    $res = $output;
+                } else {
+                    $res = false;
+                }
             } else {
-                $res = false;
+                $res = true;
             }
         } else {
-            $res = true;
+            $res = file_exists($checkOutput);
         }
 
         $time = round(microtime(true) - $start, 4);
index 37c603a9184e9f292944e523d574126f976552f8..49da6c1bb91581ed86557390c50be01c76b71655 100644 (file)
@@ -464,7 +464,9 @@ class FluidbookPublication extends ToolboxStatusModel
     public function getAccessibleFile($page, $format = 'md')
     {
         $compo = $this->getComposition()[$page];
-        return self::_getDocument($compo[0])->getMarkdown($compo[1]);
+        if ($format === 'md') {
+            return self::_getDocument($compo[0])->getMarkdown($compo[1]);
+        }
     }
 
     public function getAccessibleContents($revision = 'latest')
@@ -481,7 +483,7 @@ class FluidbookPublication extends ToolboxStatusModel
                 return $json;
             }
         } else {
-            return json_decode(gzdecode(file_get_contents($file)),true);
+            return json_decode(gzdecode(file_get_contents($file)), true);
         }
     }