escape url paths
This commit is contained in:
parent
ef04458cd8
commit
dc196fb621
@ -18,7 +18,7 @@ local function Latesthandler(self)
|
|||||||
local file_data = {}
|
local file_data = {}
|
||||||
|
|
||||||
file_data["name"] = latest_name[i]
|
file_data["name"] = latest_name[i]
|
||||||
file_data["url"] = data_path .. escape(file)
|
file_data["url"] = data_path .. file
|
||||||
|
|
||||||
table.insert(latest_json["files"], file_data)
|
table.insert(latest_json["files"], file_data)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
local lfs = require 'lfs_ffi'
|
local lfs = require 'lfs_ffi'
|
||||||
local config = require("lapis.config").get()
|
local config = require("lapis.config").get()
|
||||||
|
local escape = require("lapis.util").escape
|
||||||
|
|
||||||
|
|
||||||
-- setup
|
-- setup
|
||||||
@ -63,17 +64,17 @@ utils['these_files'] = function( path )
|
|||||||
if utils.match_ext( file, type_image ) then
|
if utils.match_ext( file, type_image ) then
|
||||||
table.insert( images, file )
|
table.insert( images, file )
|
||||||
elseif utils.match_ext( file, type_media ) then
|
elseif utils.match_ext( file, type_media ) then
|
||||||
table.insert( files, file )
|
table.insert( files, {sane=escape(file), file=file} )
|
||||||
end
|
end
|
||||||
elseif lfs.attributes( path .. file, "mode" ) == "directory" then
|
elseif lfs.attributes( path .. file, "mode" ) == "directory" then
|
||||||
table.insert( dirs, file )
|
table.insert( dirs, {sane=escape(file), dir=file} )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
table.sort( images )
|
table.sort( images )
|
||||||
table.sort( files )
|
-- table.sort( files )
|
||||||
table.sort( dirs )
|
-- table.sort( dirs )
|
||||||
|
|
||||||
local stuff = {
|
local stuff = {
|
||||||
files = files,
|
files = files,
|
||||||
@ -88,7 +89,7 @@ utils['these_latest'] = function( path )
|
|||||||
local latest_path, latest_name = {}, {}
|
local latest_path, latest_name = {}, {}
|
||||||
|
|
||||||
for i, file_path in ipairs( utils.latest_files( path ) ) do
|
for i, file_path in ipairs( utils.latest_files( path ) ) do
|
||||||
table.insert( latest_path, file_path)
|
table.insert( latest_path, escape(file_path))
|
||||||
|
|
||||||
local temp = ""
|
local temp = ""
|
||||||
local result = ""
|
local result = ""
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<h1 class="h1">Latest uploads:</h1>
|
<h1 class="h1">Latest uploads:</h1>
|
||||||
<% for i, file in ipairs(latestpath) do %>
|
<% for i, file in ipairs(latestpath) do %>
|
||||||
<a class="amixlink" href="<%= '/data/' .. titles.url .. '/' .. file:gsub("#", "%%23") %>">
|
<a class="amixlink" href="<%= '/data/' .. titles.url .. '/' .. file %>">
|
||||||
<span class="mixlink"><%= latestname[i] %></span>
|
<span class="mixlink"><%= latestname[i] %></span>
|
||||||
</a>
|
</a>
|
||||||
</br>
|
</br>
|
||||||
|
|||||||
@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
<% for i, dir in ipairs(dirs) do %>
|
<% for i, dir in ipairs(dirs) do %>
|
||||||
<br>
|
<br>
|
||||||
<a href="<%= uri .. dir %>" class="djsection"><span><%= dir %></span></a>
|
<a href="<%= uri .. dir["sane"] %>" class="djsection"><span><%= dir["dir"] %></span></a>
|
||||||
<br>
|
<br>
|
||||||
<% end %>
|
<% end %>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<% for i, file in ipairs(files) do %>
|
<% for i, file in ipairs(files) do %>
|
||||||
<a class="amixlink" href="<%= path .. file:gsub("#", "%%23") %>">
|
<a class="amixlink" href="<%= path .. file["sane"] %>">
|
||||||
<span class="mixlink"><%= file %></span>
|
<span class="mixlink"><%= file["file"] %></span>
|
||||||
</a>
|
</a>
|
||||||
<br>
|
<br>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user