Skip to content

Commit 8116aa9

Browse files
committed
#1965 Deltas broke exporting of variables
1 parent 6458daa commit 8116aa9

2 files changed

Lines changed: 29 additions & 7 deletions

File tree

GSE/Localization/ModL_enUS.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ L["Restored macro '%s' required by sequence '%s'."] = true
8484
-- Export dependency auto-include
8585
L["Auto-included %d variable(s) required by %s: %s"] = true
8686
L["WARNING: %s depends on variable(s) that do not exist and cannot be exported: %s"] = true
87+
L["Unable to interpret variable '%s'."] = true
8788
L["'%s' cannot be shared — it is protected content."] = true
8889
L["Cannot share protected content"] = true
8990
L["%s embeds sequence '%s' — add it to the export if needed."] = true

GSE_GUI/Export.lua

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ local UI = GSE.UI
88
local L = GSE.L
99

1010
local exportframe = UI:Create("Frame")
11-
local uncompressedVersion = nil
1211
exportframe:SetSize(760, 560)
1312
exportframe:Hide()
1413
exportframe.classid = 0
@@ -403,11 +402,26 @@ GSE.GUIAdvancedExport = function(exportframe, objectname, exportCategory)
403402
"OnValueChanged",
404403
function(obj, event, key, checked)
405404
if checked then
406-
uncompressedVersion.objectType = "VARIABLE"
407-
uncompressedVersion.name = key
408-
exportTable["Variables"][key] = GSE.EncodeMessage(uncompressedVersion)
405+
if exportTable["Variables"][key] then return end
406+
local stored = not GSE.isEmpty(GSEVariables) and GSEVariables[key] or nil
407+
local payload
408+
if type(stored) == "string" and stored:sub(1, 7) == "!GSE3!+" then
409+
-- Protected variable: ship the packed string untouched so the
410+
-- import side stores it still encrypted.
411+
payload = stored
412+
else
413+
local ok, decoded = GSE.DecodeMessage(stored or "")
414+
if not ok or type(decoded) ~= "table" then
415+
GSE.Print(string.format(L["Unable to interpret variable '%s'."], key), "Error")
416+
return
417+
end
418+
decoded.name = key
419+
payload = decoded
420+
end
421+
exportTable["Variables"][key] = payload
409422
exportTable.ElementCount = exportTable.ElementCount + 1
410423
else
424+
if not exportTable["Variables"][key] then return end
411425
exportTable["Variables"][key] = nil
412426
exportTable.ElementCount = exportTable.ElementCount - 1
413427
end
@@ -446,11 +460,18 @@ GSE.GUIAdvancedExport = function(exportframe, objectname, exportCategory)
446460
for vname in pairs(allDeps) do
447461
if not GSE.isEmpty(GSEVariables) and not GSE.isEmpty(GSEVariables[vname]) then
448462
if not exportTable["Variables"][vname] then
449-
local ok, decoded = GSE.DecodeMessage(GSEVariables[vname])
450-
if ok and decoded then
451-
exportTable["Variables"][vname] = decoded
463+
local storedVar = GSEVariables[vname]
464+
if type(storedVar) == "string" and storedVar:sub(1, 7) == "!GSE3!+" then
465+
exportTable["Variables"][vname] = storedVar
452466
exportTable.ElementCount = exportTable.ElementCount + 1
453467
table.insert(included, vname)
468+
else
469+
local ok, decoded = GSE.DecodeMessage(storedVar)
470+
if ok and type(decoded) == "table" then
471+
exportTable["Variables"][vname] = decoded
472+
exportTable.ElementCount = exportTable.ElementCount + 1
473+
table.insert(included, vname)
474+
end
454475
end
455476
end
456477
else

0 commit comments

Comments
 (0)