Skip to main content

safe_relative

Function safe_relative 

Source
pub fn safe_relative(name: &str) -> Option<String>
Expand description

An entry name as a relative /-separated path that cannot leave the target, or None for a name that tries: any .. segment, a leading separator, a : (a drive or an alternate data stream), a NUL, or nothing at all. Names Windows would quietly rewrite go too: a trailing dot or space, and a reserved device name such as aux.ini.

\ is a separator too: Windows archivers write it, and treating it as a character would both mis-name files and let ..\..\x through.