fix: allow spaces in iframe query strings in HTML formatting (#2292)

fix #2269
This commit is contained in:
Yohan Boniface 2024-11-22 09:46:56 +01:00 committed by GitHub
commit 735c74dcb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 4 deletions

View file

@ -147,7 +147,7 @@ describe('Utils', () => {
)
})
it('should handle iframe with height with px', () => {
it('should handle double iframe', () => {
assert.equal(
Utils.toHTML(
'A double iframe: {{{https://osm.org/pouet}}}{{{https://osm.org/boudin}}}'
@ -156,6 +156,15 @@ describe('Utils', () => {
)
})
it('should handle iframe with query string and space', () => {
assert.equal(
Utils.toHTML(
'An iframe with query string: {{{https://osm.org/pouet.html?name=foobar&description=baz baz}}}'
),
'An iframe with query string: <div><iframe height="300px" width="100%" src="https://osm.org/pouet.html?name=foobar&amp;description=baz baz" frameborder="0"></iframe></div>'
)
})
it('http link with http link as parameter as variable', () => {
assert.equal(
Utils.toHTML('A phrase with a [[http://iframeurl.com?to=http://another.com]].'),
@ -263,6 +272,19 @@ describe('Utils', () => {
)
})
it('should process variables in http links', () => {
assert.equal(
Utils.greedyTemplate(
'A phrase with a {{{https://osm.org/pouet?name={name}&description={description}}}}.',
{
name: 'foobar',
description: 'bazbaz',
}
),
'A phrase with a {{{https://osm.org/pouet?name=foobar&description=bazbaz}}}.'
)
})
it('should not accept dash', () => {
assert.equal(
Utils.greedyTemplate('A phrase with a {var-iable}.', { 'var-iable': 'value' }),