From 2f5d59dd324a65d5eb664735fa713e41ffd27d4d Mon Sep 17 00:00:00 2001 From: David Bailey Date: Thu, 14 Dec 2023 11:48:03 +0100 Subject: [PATCH] fix: :bug: fix wrong usave of copy (should have been move_uploaded_file) --- www/post_adapter.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/www/post_adapter.php b/www/post_adapter.php index 6ad8ae6..ff082ec 100644 --- a/www/post_adapter.php +++ b/www/post_adapter.php @@ -55,7 +55,7 @@ class PostHandler extends MySQLAdapter { function save_file($post_path, $file_path) { $this->bump_post($post_path); - copy($file_path, $this->data_directory . $post_path); + move_uploaded_file($file_path, $this->data_directory . $post_path); } function save_markdown_post($post_path, $post_data) { @@ -66,7 +66,6 @@ class PostHandler extends MySQLAdapter { $post_metadata = $frontmatter_post->matter(); if(basename($post_path) == "README.md") { - $readme_metadata = []; if(isset($post_metadata['directory_data'])) { $readme_metadata = $post_metadata['directory_data']; @@ -86,8 +85,7 @@ class PostHandler extends MySQLAdapter { case "md": $this->save_markdown_post($post_path, file_get_contents($file_path)); - file_put_contents($this->data_directory . $post_path, - $post_data); + move_uploaded_file($file_path, $this->data_directory . $post_path); break; case "mddesc": $this->save_markdown_post(chop($post_path, '.mddesc'), file_get_contents($file_path));