Class: Shugoi::ChallengePath
- Inherits:
-
Object
- Object
- Shugoi::ChallengePath
- Defined in:
- lib/shugoi/challenge_path.rb
Class Method Summary collapse
Class Method Details
.sanitize(path) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/shugoi/challenge_path.rb', line 3 def self.sanitize(path) return '/' if path.to_s.empty? return '/' unless path.start_with?('/') return '/' if path.start_with?('//') || path.include?('\\') return '/' if path.each_codepoint.any? { |codepoint| codepoint < 0x20 || codepoint == 0x7f } path end |