<% def sanitize_path(path) result = path if (!path.start_with?('/')) result = '/' + result end if (!path.end_with?('/')) result = result + '/' end result end %>