pub / rememori

Simple file-based bookmarking and notes application
git clone https://src.jayvii.de/pub/rememori.git
Home | Log | Files | Exports | Refs | README | RSS

commit f94da1704831a8d34790eba8f88d6b8d9c3cb288
parent 2b22a25ec5ccdfddede69d130a680ea1c3dd7171
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sun, 27 Oct 2024 16:15:01 +0100

fix: do not attempt to move a new file

Diffstat:
Mlib/edit.php | 2+-
Mlib/show.php | 9++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/edit.php b/lib/edit.php @@ -13,7 +13,7 @@ function edit_note( /* if old and new filepaths differ, the file was likely renamed. * delete the old one and return immediately */ - if ($filepath_t1 != $filepath_t0) { + if ($filepath_t1 != $filepath_t0 && !empty($filepath_t1)) { $renamed = rename( $GLOBALS["data_dir"] . "/" . $user . "/" . $filepath_t1, $GLOBALS["data_dir"] . "/" . $user . "/" . $filepath_t0 diff --git a/lib/show.php b/lib/show.php @@ -9,6 +9,13 @@ function show_note( /* Read Note: if it does not exist yet, use empty string */ $content = read_note($user, $category, $filename); + /* generate old filename. leave empty if there was one */ + if (!empty($category) && !empty($filename)) { + $filepath_t1 = $category . "/" . $filename; + } else { + $filepath_t1 = ""; + } + ?> <!-- Show Text Note Form --> @@ -33,7 +40,7 @@ function show_note( id="filepath_t1" name="filepath_t1" type="hidden" - value="<?php echo $category . "/" . $filename; ?>" + value="<?php echo $filepath_t1; ?>" > <input id="action"