Accept plain-text values in the node banner record
Only ';' needs encoding, so the title and body fit in one TXT string. Values that aren't valid percent-encoding are used as-is instead of hiding the banner.
This commit is contained in:
1 parent
ee382f9177
commit
69693f5a89
3 files changed
+87
-86
No files matched your search
@@ -34,6 +34,18 @@ void main() {
|
||||
expect(config.action, isNull);
|
||||
});
|
||||
|
||||
test('accepts plain-text values', () {
|
||||
final config = NodeBannerConfig.parse(
|
||||
'v=1;on=1;url=https://shop.example.com/node?ref=a&b=c;'
|
||||
'title=Need a new node?;body=Waterproof, 50% off this week.;'
|
||||
'cta=Get one here',
|
||||
)!;
|
||||
expect(config.url.toString(), 'https://shop.example.com/node?ref=a&b=c');
|
||||
expect(config.title, 'Need a new node?');
|
||||
expect(config.body, 'Waterproof, 50% off this week.');
|
||||
expect(config.action, 'Get one here');
|
||||
});
|
||||
|
||||
test('is off for on=0, unknown versions, and non-https links', () {
|
||||
expect(
|
||||
NodeBannerConfig.parse(_record.replaceAll('on=1', 'on=0')),
|
||||
|
||||
Reference in new issue
Block a user