Description Usage Arguments Value Valid names
Validates filenames for use in system commands. Allows for either blacklist and whitelist filtering, and independently controls several characters in common use in filenames that could be dangerous in some contexts. Optionally may also require a filename to exist or not to exist.
1 2 |
names |
A vector of filenames to check. |
exists |
NULL Can set |
weak |
default this is |
okSpace |
Set |
okTilde |
Set |
okBackslash |
Set |
okComma |
Set |
okColon |
Set |
Returns a vector of booleans the same length as the input names, TRUE if the file is safe, FALSE if it fails any test.
Filtering at a single character level will catch most bad names:
Always bad | ` $ ( ) | ; & > < |
Always ok | A:Z a:z 0:9 _ . - / |
Can set bad | " " (space) |
Can set bad | ~ (tilde will be allowed anywhere) |
Can set ok | \ , : |
May not start with | + - |
In addition, no filename may contain either " -"
or " +"
( the
-
or +
character preceded by a space.) This prevents injecting
new options.
By default, whitelist validation is used. Files may only use charcters
explicitly allowed. Can switch to blacklist validation by setting weak=
TRUE
, which allows any character not explicitly banned.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.