File tree 1 file changed +21
-5
lines changed 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)
298
298
end
299
299
end
300
300
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
+
301
312
function dtutils_string .sanitize (str )
302
313
local old_log_level = log .log_level ()
314
+ local sanitized_str = nil
303
315
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
307
322
else
308
- log .log_level (old_log_level )
309
- return _sanitize_posix (str )
323
+ sanitized_str = str
310
324
end
325
+ log .log_level (old_log_level )
326
+ return sanitized_str
311
327
end
312
328
313
329
dtutils_string .libdoc .functions [" sanitize_lua" ] = {
You can’t perform that action at this time.
0 commit comments