From 0c492891c558f9def507e848addf3a11dbcde343 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 22 Jun 2025 15:13:35 +0500 Subject: fix: set password if it wasnt provided --- public/upload.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'public') diff --git a/public/upload.php b/public/upload.php index 21219ad..3ec525a 100644 --- a/public/upload.php +++ b/public/upload.php @@ -40,6 +40,7 @@ try { $file = null; } $paste = isset($_POST['paste']) ? $_POST['paste'] ?: null : null; + $password = $_POST['password'] ?? generate_random_char_sequence(FILE_ID_CHARACTERS, FILE_DELETION_KEY_LENGTH); $file_data = null; if (!(isset($file) ^ isset($url) ^ isset($paste)) || (isset($file) && isset($url) && isset($paste))) { @@ -258,8 +259,8 @@ try { 'download_url' => INSTANCE_URL . "/{$file_data['id']}.{$file_data['extension']}" ]; - if (FILE_DELETION && !empty($_POST['password'])) { - $file_data['password'] = $_POST['password'] ?? generate_random_char_sequence(FILE_ID_CHARACTERS, FILE_DELETION_KEY_LENGTH); + if (FILE_DELETION && !empty($password)) { + $file_data['password'] = $password; $file_data['urls']['deletion_url'] = INSTANCE_URL . "/delete.php?f={$file_data['id']}.{$file_data['extension']}&key={$file_data['password']}"; } -- cgit v1.2.3