Dylan Thacker-Smith
dfbbf87ba9
Use BlockBody from Document using composition rather than inheritence
...
This way liquid-c can more cleanly use a Liquid::C::BlockBody object
for the block body by overriding Liquid::Document#new_body.
2020-09-08 14:00:52 -04:00
Dylan Thacker-Smith
037b603603
Turn some Liquid::BlockBody methods into class methods for liquid-c
...
So they can be used from a Liquid::C::BlockBody
2020-09-08 14:00:48 -04:00
Dylan Thacker-Smith
bd33df09de
Provide Block#new_body so that liquid-c can override it
...
This way liquid-c can return a body of a different class that wraps
a C implementation.
2020-09-08 13:59:48 -04:00
Dylan Thacker-Smith and GitHub
6ca5b62112
Merge pull request #1285 from Shopify/fix-render-length-resource-limit
...
Fix render length resource limit so it doesn't multiply nested output
2020-09-08 13:57:30 -04:00
Dylan Thacker-Smith
e1a2057a1b
Update assign_score during capturing
...
To stop long captures before they grow the heap more then they should.
2020-09-03 11:13:08 -04:00
Dylan Thacker-Smith
ae9dbe0ca7
Fix render length resource limit so it doesn't multiply nested output
2020-09-03 11:13:04 -04:00
Dylan Thacker-Smith and GitHub
3b486425b0
Handle BlockBody#blank? at parse time ( #1287 )
2020-09-03 11:07:13 -04:00
Dylan Thacker-Smith and GitHub
b08bcf00ac
Push interrupts from Continue and Break tags rather than from BlockBody ( #1286 )
2020-09-03 06:55:24 -04:00
Dylan Thacker-Smith and GitHub
0740e8b431
Remove unused quirk allowing liquid tags to close a block it is nested in ( #1284 )
2020-09-03 06:51:56 -04:00
Dylan Thacker-Smith and GitHub
5532df880f
Handle disabled tags errors like other liquid errors ( #1275 )
2020-08-18 11:39:54 -04:00
Dylan Thacker-Smith and GitHub
2b11efc3ae
Fix performance regression from introduction of Template#disable_tags ( #1274 )
2020-08-18 11:25:51 -04:00
Dylan Thacker-Smith and GitHub
1ced4eaf10
Merge pull request #1268 from Shopify/remove-taint-checking
...
Remove support for taint checking
2020-07-25 21:27:46 -04:00
Dylan Thacker-Smith
4970167726
Bump rake development dependency
...
Gets rid of a deprecation warning when running the tests.
2020-07-23 16:23:18 -04:00
Dylan Thacker-Smith
065ccbc4aa
Remove support for taint checking
2020-07-23 16:22:46 -04:00
Dylan Thacker-Smith and GitHub
bd0e53bd2e
Merge pull request #1239 from Shopify/remove-bad-arity-assumption
...
Fix ParseTreeVisitorTest for ruby-head
2020-05-21 14:02:04 -04:00
Dylan Thacker-Smith
c2f67398d0
Allow ruby-head failures
...
Ignore an object allocation test failure on ruby-head for now.
2020-03-31 10:53:49 -04:00
Dylan Thacker-Smith
81149344a5
Fix ParseTreeVisitorTest for ruby-head
2020-03-31 10:53:46 -04:00
Dylan Thacker-Smith and GitHub
e9b649b345
Fix Liquid::Template inheritance ( #1227 )
...
self.class.default_resource_limits would return `nil` in a subclass, since
the attribute isn't set on subclasses.
2020-01-21 15:09:22 -05:00
Dylan Thacker-Smith and GitHub
48a155a213
Initialize Liquid::Template class attributes eagerly instead of lazily ( #1223 )
2020-01-10 17:42:01 -05:00
Dylan Thacker-Smith and GitHub
c69a9a77c6
Merge pull request #1215 from Shopify/nested-liquid-tag
...
Fix liquid tag nested in outer block
2020-01-09 19:24:52 -05:00
Dylan Thacker-Smith
ef79fa3898
style: Avoid deep nesting for parsing the liquid tag in the block body
2020-01-09 19:13:13 -05:00
Dylan Thacker-Smith
f7ad602bfc
Fix liquid tag nested in outer block
2020-01-09 19:13:13 -05:00
Dylan Thacker-Smith and GitHub
ffd6049ba2
Merge pull request #1222 from Shopify/bump-ci-ruby
...
Test against the latest ruby in CI
2020-01-09 18:12:36 -05:00
Dylan Thacker-Smith
b3ad54c0c2
Test against the latest ruby in CI
2020-01-09 13:15:34 -05:00
Dylan Thacker-Smith
67eca3f58d
Upgrade rubocop and style guide for ruby 2.7 compatibility
2020-01-09 13:15:34 -05:00
Dylan Thacker-Smith and GitHub
8074565c3e
Merge pull request #1216 from Shopify/unsupported-taint-mode
...
Remove support for taint_mode on ruby versions that don't support it
2020-01-07 10:12:36 -05:00
Dylan Thacker-Smith
22dbf90b7d
Try to stay compatible with ruby-head
2019-12-19 11:12:55 -05:00
Dylan Thacker-Smith
40c68c9c83
Remove support for taint_mode on ruby versions that don't support it
2019-12-19 11:12:51 -05:00
Dylan Thacker-Smith and GitHub
5f0b64cebc
Merge pull request #1005 from christopheraue/render_refactor
...
Refactored and optimized rendering
2018-04-19 16:44:57 -04:00
Dylan Thacker-Smith and GitHub
4369fe6c85
Improve the unexpected end delimiter message for block tags. ( #1003 )
2018-04-05 11:18:13 -04:00
Dylan Thacker-Smith
04d552fabb
Gemfile: Use https rather than git protocol to fetch liquid-c
2018-02-01 07:08:19 -05:00
Dylan Thacker-Smith and GitHub
5106466a2d
Add a regression test for a liquid-c trim mode bug ( #972 )
2018-01-25 10:55:01 -05:00
Dylan Thacker-Smith and GitHub
6c117fd7dd
refactor: Reduce maximum block nesting in Liquid::BlockBody#parse ( #944 )
2017-10-19 10:12:40 -04:00
Dylan Thacker-Smith and GitHub
27c91203ab
Use replacement string for replace filters literally ( #924 )
2017-08-28 11:51:20 -04:00
Dylan Thacker-Smith and GitHub
48a6d86ac2
Use stackprof to test to lack of object allocations ( #896 )
2017-05-12 09:20:51 -04:00
Dylan Thacker-Smith and GitHub
3bb29d5456
Replace assert_equal nil, with a assert_nil ( #895 )
2017-05-11 14:05:03 -04:00
Dylan Thacker-Smith and GitHub
9c72ccb82f
Limit how much blocks can be nested during parsing ( #894 )
2017-05-11 09:37:53 -04:00
Dylan Thacker-Smith and GitHub
62d4625468
Use a loop to strictly parse binary comparisons to avoid recursion ( #892 )
...
Using recursion allows a malicious template to cause a SystemStackError
2017-05-10 10:41:52 -04:00
Dylan Thacker-Smith and GitHub
8928454e29
Use a loop to evaluate binary comparisions to avoid recursion ( #891 )
...
Using recursion allows a malicious template to cause a SystemStackError
2017-05-10 10:41:24 -04:00
Dylan Thacker-Smith and GitHub
27d5106dc9
Merge pull request #860 from Shopify/handle-string-node-render-exc
...
Avoid calling line_number on String node when rescuing a render error.
2017-02-10 14:13:11 -05:00
Dylan Thacker-Smith
7334073be2
Avoid duck typing to detect whether to call render on a node.
2017-02-10 13:49:26 -05:00
Dylan Thacker-Smith
5dcefd7d77
Avoid calling line_number on String node when rescuing a render error.
2017-02-07 15:34:10 -05:00
Dylan Thacker-Smith and GitHub
0c58328a40
test: Equality comparison of two hashes ( #850 )
2017-01-16 15:56:38 -05:00
Dylan Thacker-Smith and GitHub
2bb3552033
Fix internal liquid error when comparing hash with incompatible type ( #849 )
2017-01-16 13:13:17 -05:00
Dylan Thacker-Smith and GitHub
869dbc7ebf
feature: Allow a default exception renderer to be specified ( #837 )
...
This could be used to preserve the old default of rendering
non-Liquid::Error messages or for providing default behaviour like error
reporting which could be missed if the exception renderer needed to be
specified on each render.
2016-12-12 10:29:09 -05:00
Dylan Thacker-Smith and GitHub
fae3a2de7b
Add version constraint to rake to fix CI ( #836 )
2016-12-09 14:01:15 -05:00
Dylan Thacker-Smith and GitHub
f27bd619b9
change: Render an opaque internal error by default for non-Liquid::Error ( #835 )
...
These errors may contain sensitive information, so is safer to
render a more vague message by default.
This is done by replacing non-Liquid::Error exceptions with a
Liquid::InternalError exception with the non-Liquid::Error accessible on
through the cause method. This also allows the template name and line
number to be attached to the template errors.
The exception_handler render option has been changed to exception_renderer
since now it should raise an exception to re-raise on a liquid rendering
error or return a string to be rendered where the error occurred.
2016-12-07 17:34:29 -05:00
Dylan Thacker-Smith
a9b84b7806
test: Use ruby 2.1 in Circle CI
2016-12-05 15:36:42 -05:00
Dylan Thacker-Smith and GitHub
6cc2c567c5
Merge pull request #832 from Shopify/drop-ruby-2.0
...
Drop support for ruby 2.0
2016-12-05 13:56:15 -05:00
Dylan Thacker-Smith
812e3c51b9
test: Add ruby 2.3.3 to CI
...
Travis doesn't have a ruby 2.3 alias, so the latest 2.3.x version is
specified instead.
2016-12-05 13:53:02 -05:00
Dylan Thacker-Smith
9dd0801f5c
Drop support for ruby 2.0
...
It is no longer maintained upstream
2016-12-05 13:51:49 -05:00
Dylan Thacker-Smith and GitHub
b146b49f46
fix: Clear the strainer cache when a global filter is added ( #826 )
2016-11-24 10:32:11 -05:00
Dylan Thacker-Smith
3ea84f095f
Merge pull request #734 from Shopify/concat-liquid-error
...
Raise a Liquid::Error when a non-array is passed into the concat filter.
2016-03-31 15:47:43 -04:00
Dylan Thacker-Smith
4239c899a4
Raise a Liquid::Error when a non-array is passed into the concat filter.
2016-03-31 15:47:06 -04:00
Dylan Thacker-Smith
99b5e86f0a
Merge pull request #680 from jcheatham/master
...
Ensure truncate is operating on a string
2015-12-23 18:41:39 -05:00
Dylan Thacker-Smith
5f8086572b
Merge pull request #667 from Shopify/remove-empty-string-check
...
Remove nil and empty string check in invoke_drop.
2015-11-10 10:43:11 -05:00
Dylan Thacker-Smith
bdb9a4a47f
Remove nil and empty string check in invoke_drop.
2015-11-09 15:03:36 -05:00
Dylan Thacker-Smith
c38eec0293
Merge pull request #665 from tanelj/escape_filter_nil_fix
...
Fixed issue where "nil" value for "escape" filter breaks rendering
2015-11-06 10:54:48 -05:00
Dylan Thacker-Smith
d8bda2c892
Merge pull request #653 from Shopify/fix-rubocop-offenses
...
Fix offenses from the new version of rubocop.
2015-09-25 19:48:09 -04:00
Dylan Thacker-Smith
4f81c0a658
Lock rubocop version to avoid CI failures from new releases.
2015-09-25 19:42:35 -04:00
Dylan Thacker-Smith
704937bc00
Fix offenses from the new version of rubocop.
2015-09-25 19:34:44 -04:00
Dylan Thacker-Smith
fa187665b3
Merge pull request #631 from Shopify/fix-tz-test-failure
...
Fix a timezone test failure.
2015-07-23 16:34:48 -04:00
Dylan Thacker-Smith
cd0c5e954c
Fix a timezone test failure.
2015-07-23 16:19:59 -04:00
Dylan Thacker-Smith
14416b3c49
Move the syntax error rescue for adding error line numbers.
2015-07-09 11:25:05 -04:00
Dylan Thacker-Smith
bde14a650d
Merge pull request #617 from Shopify/rename-options-iv
...
Rename options instance variable in Variable and Tag.
2015-07-08 20:50:20 -04:00
Dylan Thacker-Smith
c535af021a
Rename options instance variable in Variable and Tag.
2015-07-08 19:59:44 -04:00
Dylan Thacker-Smith
9c9345869b
Merge pull request #614 from Shopify/remove-token-class
...
Implement line numbers without the Liquid::Token class.
2015-07-08 19:48:55 -04:00
Dylan Thacker-Smith
73834a7e52
Use reject rather than dup and delete.
2015-07-08 19:27:24 -04:00
Dylan Thacker-Smith
c45310170b
Use parse_context or options instead of @options.
2015-07-08 19:21:59 -04:00
Dylan Thacker-Smith
920e1df643
Rescue and re-raise syntax errors in Template#parse to add line numbers.
...
This can be done now that the parse context has the line number
information, so it doesn't need to be added on closer to the original
exception. This has the advantage of not having to rescue and re-raise the
exception multiple times, and simplifies liquid-c which would otherwise
have to rescue the exception in BlockBody#parse.
2015-07-08 19:21:59 -04:00
Dylan Thacker-Smith
cebf75b8d7
Implement line numbers without the Liquid::Token class.
2015-07-08 19:21:59 -04:00
Dylan Thacker-Smith
338287df5e
Merge pull request #613 from Shopify/taint-context-warning
...
Add taint warnings to the context rather than the template.
2015-07-07 16:23:10 -04:00
Dylan Thacker-Smith
c4c398174b
Use early returns rather than large if in Variable#taint_check
2015-07-07 15:56:03 -04:00
Dylan Thacker-Smith
80b6ac3bc7
Add taint warnings to the context rather than the template.
2015-07-07 15:53:02 -04:00
Dylan Thacker-Smith
15974d9168
Merge pull request #612 from Shopify/fix-block-body-naming
...
Use node to refer to objects from the nodelist rather than token.
2015-07-07 15:49:58 -04:00
Dylan Thacker-Smith
f22ab4358b
Merge pull request #611 from Shopify/no-escape-rescue
...
Remove standard exception rescue in escape filter.
2015-07-07 15:49:43 -04:00
Dylan Thacker-Smith
fad3b8275c
Use node to refer to objects from the nodelist rather than token.
2015-07-04 20:57:35 -04:00
Dylan Thacker-Smith
5a071cb7f2
Remove standard exception rescue in escape filter.
2015-07-04 13:48:25 -04:00
Dylan Thacker-Smith
6968def5dd
Merge pull request #574 from Shopify/template-name-in-errors
...
Include template name with line numbers in render errors.
2015-06-04 15:28:12 -04:00
Dylan Thacker-Smith
ad3748af21
Include template name with line numbers in render errors.
2015-06-04 13:44:01 -04:00
Dylan Thacker-Smith
b79c0c611c
Merge pull request #586 from Shopify/string-contains-non-string
...
Avoid an exception from checking if a string contains a non-string.
2015-06-03 10:58:38 -04:00
Dylan Thacker-Smith
8a2947865b
Avoid an exception from checking if a string contains a non-string.
2015-06-03 02:21:51 -04:00
Dylan Thacker-Smith
ea29f8b4b8
Merge pull request #583 from Shopify/slice-nil-offset
...
Raise a Liquid::ArgumentError in slice filter for invalid integers.
2015-06-03 01:43:56 -04:00
Dylan Thacker-Smith
c84f4520cc
Keep input out of error message and add test for slice Integer parsing.
2015-06-03 01:35:01 -04:00
Dylan Thacker-Smith
3dd6433e2f
Merge pull request #584 from Shopify/replace-non-string
...
Convert arguments to replace filters to strings to avoid exceptions.
2015-06-02 16:41:15 -04:00
Dylan Thacker-Smith
ab7109a335
Raise a Liquid::ArgumentError in slice filter for invalid integers.
2015-06-02 16:05:08 -04:00
Dylan Thacker-Smith
94fe050952
Convert arguments to replace filters to strings to avoid exceptions.
2015-06-02 15:59:29 -04:00
Dylan Thacker-Smith
27245c9eab
Merge pull request #577 from Shopify/table-row-blank-string-collection
...
Fix exception from using an empty string for the table row collection.
2015-05-28 16:20:42 -04:00
Dylan Thacker-Smith
c1eb694057
Remove the redundant iterable check in the for tag.
...
Just do it in slice_collection for consistency with the tablerow tag.
2015-05-28 16:04:50 -04:00
Dylan Thacker-Smith
f53b31c867
Merge pull request #578 from Shopify/filter-error-handling
...
Handle some more standard filter errors.
2015-05-28 15:00:57 -04:00
Dylan Thacker-Smith
363388e92f
Handle some more standard filter errors.
2015-05-28 14:18:53 -04:00
Dylan Thacker-Smith
873eddbb85
Split a line and use String#empty? for readability
2015-05-28 12:55:04 -04:00
Dylan Thacker-Smith
e790b60f60
Fix exception from using an empty string for the table row collection.
2015-05-28 12:11:39 -04:00
Dylan Thacker-Smith
3264d60425
Merge pull request #576 from Shopify/flexible-exception-handler
...
Allow the exception handler to convert exceptions to hide error messges
2015-05-28 11:38:44 -04:00
Dylan Thacker-Smith
8ff1b8e01f
Test set_line_number_from_token after exception is converted.
2015-05-28 09:22:02 -04:00
Dylan Thacker-Smith
8d5e71f856
Allow the exception handler to convert exceptions to hide error messages.
2015-05-27 18:59:51 -04:00
Dylan Thacker-Smith
89c6e605f8
Merge pull request #575 from Shopify/zero-division-error
...
Raise Liquid::ZeroDivisionError instead of ZeroDivisionError.
2015-05-26 10:43:23 -04:00
Dylan Thacker-Smith
6265c36ec9
Raise Liquid::ZeroDivisionError instead of ZeroDivisionError.
2015-05-25 15:40:17 -04:00
Dylan Thacker-Smith
8af99ff918
Merge pull request #573 from Shopify/optional-error-rendering
...
Make liquid error rendering optional.
2015-05-25 12:11:10 -04:00
Dylan Thacker-Smith
36200ff704
Make liquid error rendering optional.
...
Although the author of the liquid template wants to see these errors, they
probably don't want the visitor to see the liquid errors. Probably the
best fallback when rendering the page for visitors is to render the empty
string for tags with errors.
2015-05-25 11:24:53 -04:00