Skip to content

Commit

Permalink
fix(XhController.groovy): utilize safeEncode() null-safety
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-xhio committed Apr 2, 2024
1 parent b304222 commit 41ed4a8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions grails-app/controllers/io/xh/hoist/impl/XhController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ class XhController extends BaseController {
ensureClientUsernameMatchesSession()
def query = parseRequestJSON()
trackService.track(
category: query.category? safeEncode(query.category.toString()): null,
msg: query.msg? safeEncode(query.msg.toString()): null,
data: query.data ? parseObjectOrArray(safeEncode(query.data.toString())) : null,
logData: query.logData? (query.logData == 'true' || query.logData == 'false' ? parseBoolean(query.logData.toString()) : query.logData.toString()?.split(',')): null,
elapsed: query.elapsed? query.elapsed: null,
severity: query.severity? safeEncode(query.severity.toString()): null,
url: query.url? safeEncode(query.url.toString()): null,
appVersion: query.appVersion? safeEncode(query.appVersion.toString()): null
category: safeEncode(query.category as String),
msg: safeEncode(query.msg as String),
data: parseObjectOrArray(safeEncode(query.data as String)),
logData: (query.logData == 'true' || query.logData == 'false') ? parseBoolean(query.logData as String) : (query.logData as String).split(','),
elapsed: query.elapsed,
severity: safeEncode(query.severity as String),
url: safeEncode(query.url as String),
appVersion: safeEncode(query.appVersion as String)
)
renderJSON(success: true)
}
Expand Down Expand Up @@ -234,11 +234,11 @@ class XhController extends BaseController {
ensureClientUsernameMatchesSession()
def query = parseRequestJSON()
clientErrorService.submit(
query.msg? safeEncode(query.msg.toString()): null,
query.error? safeEncode(query.error.toString()): null,
query.appVersion? safeEncode(query.appVersion.toString()): null,
query.url? safeEncode(query.url.toString()): null,
query.userAlerted? parseBoolean(query.userAlerted.toString()): null
safeEncode(query.msg as String),
safeEncode(query.error as String),
safeEncode(query.appVersion as String),
safeEncode(query.url as String),
parseBoolean(query.userAlerted as String)
)
renderJSON(success: true)
}
Expand Down

0 comments on commit 41ed4a8

Please sign in to comment.