powered by
path_sanitize() removes the following:
path_sanitize()
Control characters
Reserved characters
Unix reserved filenames (. and ..)
.
..
Trailing periods and spaces (invalid on Windows)
Windows reserved filenames (CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9) The resulting string is then truncated to 255 bytes in length
CON
PRN
AUX
NUL
COM1
COM2
COM3
COM5
COM6
COM7
COM8
COM9
LPT1
LPT2
LPT3
LPT4
LPT5
LPT6
LPT8
LPT9
path_sanitize(filename, replacement = "")
A character vector to be sanitized.
A character vector used to replace invalid characters.
https://www.npmjs.com/package/sanitize-filename, upon which this function is based.
# NOT RUN { # potentially unsafe string str <- "~/.\u0001ssh/authorized_keys" path_sanitize(str) path_sanitize("..") # }
Run the code above in your browser using DataLab