Skip to content

Commit 705d7df

Browse files
CopilotPDowney
andauthored
vhost-import: address code review feedback
Agent-Logs-Url: https://github.com/EngineScript/EngineScript/sessions/a63d09ad-f51e-4c06-b402-f5a643060c12 Co-authored-by: PDowney <[email protected]>
1 parent 885d420 commit 705d7df

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

scripts/functions/vhost/vhost-import.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ validate_zip_archive_paths() {
6868
# Returns true (0) when a directory is absent or contains no files/subdirs
6969
is_directory_absent_or_empty() {
7070
local dir="$1"
71-
[[ ! -d "$dir" ]] || [[ -z "$(find "$dir" -mindepth 1 -print -quit 2>/dev/null)" ]]
71+
[[ ! -d "$dir" ]] || [[ -z "$(find "$dir" -mindepth 1 -print -quit)" ]]
7272
}
7373

7474
# --- Instructions for Preparing Files ---
@@ -156,6 +156,8 @@ extract_prefix_from_db() {
156156
# Look for CREATE TABLE or INSERT INTO lines with common tables (_options or _users)
157157
# Capture the table name between backticks/quotes, then strip _options/_users to derive prefix
158158
local search_pattern="(CREATE TABLE|INSERT INTO)[[:space:]]+(\`|\")[^\`\"]+_(options|users)(\`|\")"
159+
# NOTE: [^\`\"]+ intentionally allows hyphens and other characters valid in MySQL table names,
160+
# broadening the previous [a-zA-Z0-9_]+ which would miss prefixes like "my-site_".
159161
local table_name=""
160162

161163
# Use zgrep for .gz, grep for .sql.

0 commit comments

Comments
 (0)