Character preferences / records html decoding (#17796)

Character preferences / records are now decoded correctly for the
computer UI and character preference.

Known issues, that already existed before this PR: Security incident
reports cannot be imported (nothing appears), charges and details of an
incident do not show up on the PDA application


![image](https://github.com/Aurorastation/Aurora.3/assets/65877598/86817f80-9026-49d7-92c7-57ebbffdf60c)
This commit is contained in:
Fluffy
2024-04-15 08:43:52 +00:00
committed by GitHub
parent b6f650366b
commit 417be39b6a
4 changed files with 64 additions and 9 deletions
+18 -4
View File
@@ -32,7 +32,14 @@
copied.vars[variable] = src.vars[variable]
return copied
/datum/record/proc/Listify(var/deep = 1, var/list/excluded = list(), var/list/to_update) // Mostly to support old things or to use with serialization
#define CONDITIONAL_HTML_DECODE(VAR)\
if(decode_html){\
if(istext(##VAR)){\
##VAR = html_decode(##VAR);\
}\
}
/datum/record/proc/Listify(var/deep = 1, var/list/excluded = list(), var/list/to_update, decode_html = FALSE) // Mostly to support old things or to use with serialization
var/list/record
if(!to_update)
. = record = list()
@@ -48,30 +55,37 @@
if(deep && (istype(src.vars[variable], /datum/record)))
if(to_update)
var/datum/record/R = src.vars[variable]
var/listified = R.Listify(to_update = to_update[variable])
var/listified = R.Listify(to_update = to_update[variable], decode_html = decode_html)
if(listified)
record[variable] = listified
CONDITIONAL_HTML_DECODE(record[variable])
. = record
else
var/datum/record/R = src.vars[variable]
record[variable] = R.Listify()
record[variable] = R.Listify(decode_html = decode_html)
//no escape
else if(deep && islist(src.vars[variable]) && is_list_containing_type(src.vars[variable], /datum/record))
record[variable] = list()
for(var/subr in src.vars[variable])
var/datum/record/r = subr
record[variable] += list(r.Listify())
record[variable] += list(r.Listify(decode_html = decode_html))
var/llen = 0
if((variable in to_update) && islist(to_update[variable]))
var/list/L = to_update[variable]
llen = L.len
if(llen != LAZYLEN(record[variable]))
. = record
CONDITIONAL_HTML_DECODE(.)
else if(islist(src.vars[variable]) || istext(src.vars[variable]) || isnum(src.vars[variable]))
if(to_update && record[variable] != src.vars[variable])
record[variable] = src.vars[variable]
CONDITIONAL_HTML_DECODE(record[variable])
. = record
else if(!to_update)
record[variable] = src.vars[variable]
CONDITIONAL_HTML_DECODE(record[variable])
#undef CONDITIONAL_HTML_DECODE
/datum/record/proc/Printify(var/list/excluded = list()) // Mostly to support old things or to use with serialization