use custom escape function
This commit is contained in:
parent
fe70315a63
commit
49cc36ef31
@ -1,6 +1,4 @@
|
||||
local to_json = require("lapis.util").to_json
|
||||
local autoload = require("lapis.util").autoload
|
||||
local escape = require("lapis.util").escape
|
||||
local config = require("lapis.config")
|
||||
local hotmixes = autoload("hotmixes")
|
||||
|
||||
@ -18,7 +16,7 @@ local function Roothandler(self)
|
||||
self.images = stuff.images
|
||||
self.latestpath = latest_path
|
||||
self.latestname = latest_name
|
||||
self.functions = { escape = escape }
|
||||
self.functions = { hotesc = hotmixes.utils.hotesc }
|
||||
|
||||
if self.titles['url'] == "panamaracing.club" then
|
||||
return { render = "root", layout = require "views.prc_layout" }
|
||||
|
||||
@ -30,6 +30,10 @@ local type_allowed = { jpg=true, jpeg=true, png=true, gif=true, mp3=true, flac=t
|
||||
|
||||
local utils = {}
|
||||
|
||||
local function hotesc ( str )
|
||||
return escape(str):gsub("%%2f", "/"):gsub("%%2d", "-"):gsub("%%2e", ".")
|
||||
end
|
||||
|
||||
utils['request_path'] = request_path
|
||||
utils['data_path'] = data_path
|
||||
|
||||
@ -84,12 +88,17 @@ utils['these_files'] = function( path )
|
||||
return stuff
|
||||
end
|
||||
|
||||
utils['hotesc'] = function( str )
|
||||
return hotesc(str)
|
||||
end
|
||||
|
||||
utils['these_latest'] = function( path )
|
||||
-- list last 10 modified files in our directory
|
||||
local latest_path, latest_name = {}, {}
|
||||
|
||||
for i, file_path in ipairs( utils.latest_files( path ) ) do
|
||||
table.insert( latest_path, escape(file_path))
|
||||
local escpath = hotesc(file_path)
|
||||
table.insert( latest_path, escpath )
|
||||
|
||||
local temp = ""
|
||||
local result = ""
|
||||
|
||||
@ -10,13 +10,13 @@
|
||||
|
||||
<% for i, dir in ipairs(dirs) do %>
|
||||
<br>
|
||||
<a href="<%- functions.escape(uri .. dir):gsub("%%2f", "/"):gsub("%%2d", "-"):gsub("%%2e", ".") %>" class="djsection"><span><%= dir %></span></a>
|
||||
<a href="<%- functions.hotesc(uri .. dir) %>" class="djsection"><span><%= dir %></span></a>
|
||||
<br>
|
||||
<% end %>
|
||||
<br>
|
||||
|
||||
<% for i, file in ipairs(files) do %>
|
||||
<a class="amixlink" href="<%- functions.escape(path .. file):gsub("%%2d", "-"):gsub("%%2f", "/"):gsub("%%2e", ".") %>">
|
||||
<a class="amixlink" href="<%- functions.hotesc(path .. file) %>">
|
||||
<span class="mixlink"><%= file %></span>
|
||||
</a>
|
||||
<br>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user