Actually fix the url generation
This commit is contained in:
parent
4eb5b4a7bd
commit
67de40c02b
|
@ -110,6 +110,24 @@ function util.encode_id(number)
|
||||||
until number == 0
|
until number == 0
|
||||||
return table.concat(result)
|
return table.concat(result)
|
||||||
end
|
end
|
||||||
|
--[[
|
||||||
|
Legacy code, try to encode with invalid characters in the url first
|
||||||
|
]]
|
||||||
|
local new_encode = util.encode_id
|
||||||
|
function util.encode_id(number)
|
||||||
|
if number >= config.legacy_url_cutoff then
|
||||||
|
return new_encode(number)
|
||||||
|
else
|
||||||
|
local result = {}
|
||||||
|
local charlen = string.len(url_characters_legacy)
|
||||||
|
repeat
|
||||||
|
local pos = (number % charlen) + 1
|
||||||
|
number = math.floor(number / charlen)
|
||||||
|
table.insert(result,string.sub(url_characters_legacy,pos,pos))
|
||||||
|
until number == 0
|
||||||
|
return table.concat(result)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Given a short HTML-safe url path, convert it to a storyid
|
Given a short HTML-safe url path, convert it to a storyid
|
||||||
|
|
Loading…
Reference in New Issue