mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 06:01:25 +00:00
fix(server): Correctly resolve database name for URI connection strings
URI-connection strings would incorrectly parse the database name when using additional options as part of the string (i.e. "ESXLegacy?charset=utf8mb4"). Correctly check for these options and match the string accordingly. Also just better pattern matching in general.
This commit is contained in:
+6
-3
@@ -2,9 +2,12 @@ local function DATABASE()
|
||||
local connectionString = GetConvar('mysql_connection_string', '');
|
||||
if connectionString == '' then
|
||||
error(connectionString..'\n^1Unable to start Multicharacter - unable to determine database from mysql_connection_string^0', 0)
|
||||
elseif string.match(connectionString, 'mysql://') then
|
||||
connectionString = string.sub(connectionString, string.find(connectionString, "/[^/]*$")+1)
|
||||
return connectionString
|
||||
elseif connectionString:find('mysql://') then
|
||||
if connectionString:find('?*$') then
|
||||
return connectionString:match('[^/][%w]*[?$]'):sub(0, -2)
|
||||
else
|
||||
return connectionString:match('[^/][%w]*$')
|
||||
end
|
||||
else
|
||||
connectionString = {string.strsplit(';', connectionString)}
|
||||
for i=1, #connectionString do
|
||||
|
||||
Reference in New Issue
Block a user