fix(droplet): Fix BusyBox tr bug in name sanitization too
The buggy tr '[:upper:]' '[:lower:]' was also used for sanitizing site names, causing 'ziptest' to become 'ziwtest'. Use awk tolower() for all lowercase conversions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
afaa9c05ef
commit
64a12a65ad
@ -65,8 +65,8 @@ cmd_publish() {
|
|||||||
[ -z "$name" ] && { log_error "Name required"; return 1; }
|
[ -z "$name" ] && { log_error "Name required"; return 1; }
|
||||||
[ ! -f "$file" ] && { log_error "File not found: $file"; return 1; }
|
[ ! -f "$file" ] && { log_error "File not found: $file"; return 1; }
|
||||||
|
|
||||||
# Sanitize name
|
# Sanitize name - use awk for lowercase (BusyBox tr is buggy)
|
||||||
name=$(echo "$name" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_-]/_/g')
|
name=$(echo "$name" | awk '{print tolower($0)}' | sed 's/[^a-z0-9_-]/_/g')
|
||||||
local vhost="${name}.${domain}"
|
local vhost="${name}.${domain}"
|
||||||
local tmp_dir="/tmp/droplet_$$"
|
local tmp_dir="/tmp/droplet_$$"
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ cmd_rename() {
|
|||||||
local new="$2"
|
local new="$2"
|
||||||
[ -z "$old" ] || [ -z "$new" ] && { log_error "Usage: dropletctl rename <old> <new>"; return 1; }
|
[ -z "$old" ] || [ -z "$new" ] && { log_error "Usage: dropletctl rename <old> <new>"; return 1; }
|
||||||
|
|
||||||
new=$(echo "$new" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_-]/_/g')
|
new=$(echo "$new" | awk '{print tolower($0)}' | sed 's/[^a-z0-9_-]/_/g')
|
||||||
|
|
||||||
# Check metablogizer
|
# Check metablogizer
|
||||||
if uci -q get "metablogizer.$old" >/dev/null 2>&1; then
|
if uci -q get "metablogizer.$old" >/dev/null 2>&1; then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user