From d5050d9901b55c6134cd1075d6e604a6bdaf1de6 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 22 Dec 2023 11:31:04 +0200 Subject: [PATCH] set namespace as basename --- cli/put.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cli/put.php b/cli/put.php index 0b70f9d..2add995 100644 --- a/cli/put.php +++ b/cli/put.php @@ -35,6 +35,17 @@ $md5file = md5_file( $argv[2] ); +// Get file name +$name = basename( + $argv[2] +); + +// Check filename not longer of protocol +if (mb_strlen($name) > 255) +{ + $name = $md5file; +} + // Split content to smaller parts, according to the protocol limits $size = isset($argv[3]) && $argv[3] <= 3072 ? (int) $argv[3] : 3072; @@ -66,7 +77,7 @@ $ns = _exec( sprintf( "%s '%s'", 'keva_namespace', - $md5file + $name ) );