Skip to content

Commit e8ccada

Browse files
committed
Merge branch '3.1.x' of github.com:grails/grails-core into 3.1.x
2 parents 40e1eda + d8cac19 commit e8ccada

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

grails-core/src/test/groovy/org/grails/config/PropertySourcesConfigSpec.groovy

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package org.grails.config
22

33
import org.springframework.core.env.MapPropertySource
44
import org.springframework.core.env.MutablePropertySources
5+
import spock.lang.Ignore
6+
import spock.lang.Issue
57
import spock.lang.Specification
68

79
/*
@@ -48,4 +50,28 @@ class PropertySourcesConfigSpec extends Specification {
4850

4951

5052
}
53+
54+
/*
55+
56+
We need to settle on whether the following is a bug or not.
57+
There are some tests in ConfigMapSpec that indirectly assert some
58+
behavior that I think would be inconsistent with making the following
59+
test pass.
60+
61+
*/
62+
@Ignore
63+
@Issue('grails/grails-core#10188')
64+
void 'test replacing nested property values'() {
65+
given: 'a PropertySourcesConfig'
66+
def cfg = new PropertySourcesConfig()
67+
68+
when: 'a nested property is assigned a value'
69+
cfg.foo.bar = ['one': '1']
70+
71+
and: 'later is assigned a different value'
72+
cfg.foo.bar = ['two': '2']
73+
74+
then: 'the second value is not merged with the first value'
75+
cfg.foo.bar == ['two': '2']
76+
}
5177
}

grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ class FormTagLib implements ApplicationContextAware, InitializingBean, TagLibrar
10691069
}
10701070
}
10711071
keyValue = processFormFieldValueIfNecessary(selectName, "${keyValue}","option")
1072-
writer << "value=\"${keyValue}\" "
1072+
writer << "value=\"${keyValue.toString().encodeAsHTML()}\" "
10731073
if (selected) {
10741074
writer << 'selected="selected" '
10751075
}

grails-test-suite-web/src/test/groovy/org/grails/web/taglib/SelectTagTests.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ class SelectTagTests extends AbstractGrailsTagTests {
2222
assertTrue "should have HTML escaped attributes", result.startsWith('<select id="bar&quot; /&gt;&lt;script&gt;alert(&quot;gotcha&quot;)&lt;/script&gt;.genre" name="bar&quot; /&gt;&lt;script&gt;alert(&quot;gotcha&quot;)&lt;/script&gt;.genre" >')
2323
}
2424

25+
void testSelectTagEscapingValue() {
26+
def template = '<g:select id="genre" name="genre" from="${values}" />'
27+
def result = applyTemplate(template, [values: ["\"></option></select><script>alert('hi')</script>"]])
28+
29+
println result
30+
assertTrue "should have HTML escaped values", result.contains('<option value="&quot;&gt;&lt;/option&gt;&lt;/select&gt;&lt;script&gt;alert(&#39;hi&#39;)&lt;/script&gt;" >&quot;&gt;&lt;/option&gt;&lt;/select&gt;&lt;script&gt;alert(&#39;hi&#39;)&lt;/script&gt;</option>')
31+
}
32+
2533
void testSelectUsesExpressionForDisable() {
2634
def template = '<g:set var="flag" value="${true}"/><g:select disabled="${flag}" name="foo" id="foo" from="[1,2,3]" />'
2735
assertOutputContains('disabled="disabled"', template)

0 commit comments

Comments
 (0)