Skip to content

Commit 25e8b63

Browse files
committed
fix: #47 img src data
1 parent 9d43708 commit 25e8b63

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

app/Coding/Wiki.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public function createMarkdownZip($markdown, $path, $markdownFilename): bool|str
3939
// markdown image title: ![](images/default.svg "admin")
4040
$tmp = explode(' ', $attachment);
4141
$filename = $tmp[0];
42+
if (!file_exists($path . $filename)) {
43+
error_log("文件不存在:$filename");
44+
continue;
45+
}
4246
$this->zipArchive->addFile($path . $filename, $filename);
4347
}
4448
}

app/Confluence.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function htmlFile2Markdown(string $filename): string
4040
'|<span class="confluence-embedded-file-wrapper">.*</span>|',
4141
'|<div class="drop-zone-empty-text">.*</div>|s',
4242
'|<li class="drop-zone-text hidden">.*</li>|s',
43+
'|<img .* src="data:.*/>|',
4344
],
4445
'',
4546
file_get_contents($filename)

tests/data/confluence/space1/image-demo_65619.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ <h2 id="helloworld-第二章">第二章</h2>
7474
data-base-url="http://9.134.190.26:8090" data-linked-resource-content-type="image/png"
7575
data-linked-resource-container-id="65619" data-linked-resource-container-version="4"></span></p>
7676
<p>
77+
<p><img class="drawio-diagram-image" width="821" style="width:821px;" src="data:image/png;base64,iVBORw" /></p>
7778
</div>
7879

7980
<div class="pageSection group">

0 commit comments

Comments
 (0)