File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -298,16 +298,32 @@ local function _sanitize_windows(str)
298298 end
299299end
300300
301+ local function _should_be_sanitized (str )
302+ local old_log_level = log .log_level ()
303+ local result = false
304+ log .log_level (dtutils_string .log_level )
305+ if string.match (str , " [^%g]" ) then
306+ result = true
307+ end
308+ log .log_level (old_log_level )
309+ return result
310+ end
311+
301312function dtutils_string .sanitize (str )
302313 local old_log_level = log .log_level ()
314+ local sanitized_str = nil
303315 log .log_level (dtutils_string .log_level )
304- if dt .configuration .running_os == " windows" then
305- log .log_level (old_log_level )
306- return _sanitize_windows (str )
316+ if _should_be_sanitized (str ) then
317+ if dt .configuration .running_os == " windows" then
318+ sanitized_str = _sanitize_windows (str )
319+ else
320+ sanitized_str = _sanitize_posix (str )
321+ end
307322 else
308- log .log_level (old_log_level )
309- return _sanitize_posix (str )
323+ sanitized_str = str
310324 end
325+ log .log_level (old_log_level )
326+ return sanitized_str
311327end
312328
313329dtutils_string .libdoc .functions [" sanitize_lua" ] = {
You can’t perform that action at this time.
0 commit comments