Method: Waw::StaticController::WawAccess#normalize_req_path

Defined in:
lib/waw/controllers/static/waw_access.rb

#normalize_req_path(req_path) ⇒ Object

Normalizes a requested path, removing any .html, .htm suffix



222
223
224
225
226
227
228
229
230
231
232
# File 'lib/waw/controllers/static/waw_access.rb', line 222

def normalize_req_path(req_path)
  # 1) Decode the req_path with URI::decode
  req_path = URI::decode(req_path)
  # 2) Strip first
  req_path = req_path.strip
  # 3) Remove first slash 
  req_path = req_path[1..-1] if req_path[0,1]=='/'
  # 4) Remove last slash
  req_path = req_path[0..-2] if req_path[req_path.length-1,1]=='/'
  req_path
end