Prevent autosave exports and preserve raw Markdown
This commit is contained in:
1 parent
c56ae0ced2
commit
2343999485
4 files changed
+27
-7
No files matched your search
@@ -244,6 +244,23 @@ try {
|
||||
check(Session::get('bluditGithubImport')['args']['username'] === 'spleenftw', 'A valid explicit selection overrides an unavailable repository author');
|
||||
echo "PASS: selected/repository authors on create and update, author export, no impersonation or export loop\n";
|
||||
|
||||
// Transient editor snapshots must never enter the public repository.
|
||||
$plugin->requests = [];
|
||||
$pages->add(['slug' => 'autosave-private-snapshot', 'content' => 'private draft', 'type' => 'autosave', 'username' => 'admin']);
|
||||
$plugin->afterPageCreate('autosave-private-snapshot');
|
||||
$plugin->afterPageModify('autosave-private-snapshot');
|
||||
$plugin->afterPageDelete('autosave-private-snapshot');
|
||||
check($plugin->requests === [], 'No GitHub operations for autosave snapshots');
|
||||
$fenced = "```yaml\nfirst: value\n\n indented: value\n```\n";
|
||||
$plugin->fixture('export-source', document('export-source', $fenced));
|
||||
$plugin->invoke('previewImport', 'export-source', true); $plan = Session::get('bluditGithubImport');
|
||||
$plugin->invoke('confirmImport', $plan['confirmation']);
|
||||
$plugin->requests = [];
|
||||
$plugin->invoke('exportPage', new Page('export-source'));
|
||||
$puts = array_values(array_filter($plugin->requests, function ($r) { return $r[0] === 'PUT'; }));
|
||||
check(count($puts) === 1 && strpos(base64_decode($puts[0][2]['content']), $fenced) !== false, 'Export preserves raw fenced code, not rendered HTML');
|
||||
echo "PASS: no autosave exports and raw Markdown export preserves code fences\n";
|
||||
|
||||
// Optional end-to-end fixture using an actual exported article directory.
|
||||
if (($articleDir = getenv('BLOG_ARTICLE_DIR'))) {
|
||||
$slug = basename(rtrim($articleDir, '/'));
|
||||
|
||||
Reference in new issue
Block a user