mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
fix(es_extended/client/modules/adjustments): escape placeholder values
Placeholder results go straight into gsub as the replacement string, so a % in a player name either throws and kills the presence thread or silently mangles the output. The "Unknown" fallback above it was unreachable because the error() on the previous line always propagates.
This commit is contained in:
@@ -175,11 +175,11 @@ function Adjustments:ReplacePlaceholders(text)
|
||||
local success, result = pcall(cb)
|
||||
|
||||
if not success then
|
||||
error(("Failed to execute placeholder: ^5%s^7\n%s"):format(placeholder, result))
|
||||
print(("[^1ERROR^7] Failed to execute placeholder: ^5%s^7\n%s"):format(placeholder, result))
|
||||
result = "Unknown"
|
||||
end
|
||||
|
||||
text = text:gsub(("{%s}"):format(placeholder), tostring(result))
|
||||
text = text:gsub(("{%s}"):format(placeholder), (tostring(result):gsub("%%", "%%%%")))
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user