properly handling uri emplacement
This commit is contained in:
parent
c31365115b
commit
5a302976aa
|
@ -178,7 +178,7 @@ module PointBlank
|
|||
string = string.gsub(/\\([!"\#$%&'()*+,\-.\/:;<=>?@\[\\\]\^_`{|}~])/,
|
||||
'\\1')
|
||||
string = string.gsub("\n", " ")
|
||||
URI.encode_uri_component(
|
||||
MMMD::EntityUtils.encode_uri(
|
||||
MMMD::EntityUtils.decode_entities(string)
|
||||
)
|
||||
end
|
||||
|
@ -1210,7 +1210,7 @@ module PointBlank
|
|||
return '<', parts[1..] unless buffer.match?(/^<[\w\-_+]+:[^<>\s]+>$/)
|
||||
|
||||
obj = build([buffer[1..-2]])
|
||||
obj.properties[:uri] = buffer[1..-2]
|
||||
obj.properties[:uri] = MMMD::EntityUtils.encode_uri(buffer[1..-2])
|
||||
[obj, parts[(cutoff + 1)..]]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -315,6 +315,7 @@ module MMMD
|
|||
|
||||
def read_title(element)
|
||||
title = element.properties[:title]
|
||||
title = ::MMMD::EntityUtils.encode_entities(title)
|
||||
title.inspect
|
||||
end
|
||||
|
||||
|
|
|
@ -48,5 +48,14 @@ module MMMD
|
|||
.gsub('"', """)
|
||||
.gsub("'", "'")
|
||||
end
|
||||
|
||||
# Encode uri components that may break HTML syntax
|
||||
# @param string [String]
|
||||
# @return [String]
|
||||
def self.encode_uri(string)
|
||||
string.gsub('"', "%22")
|
||||
.gsub("'", "%27")
|
||||
.gsub(" ", "%20")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue