fix(log): fix typo in log macro accessing non-existent 'access' key - #609
Open
pecastro wants to merge 1 commit into
Open
fix(log): fix typo in log macro accessing non-existent 'access' key#609pecastro wants to merge 1 commit into
pecastro wants to merge 1 commit into
Conversation
Inside the 'log' macro, the template iterates over log['access'] entries
using '{% for log in log['access'] %}'. Within this loop, each 'log'
is an individual access log entry dict with keys: path, format, buffer,
gzip, flush, if.
The gzip conditional on line 193 (http) / line 65 (stream) contained a
typo: it accessed log['access']['gzip'] instead of log['gzip']. Since
entry dicts have no 'access' key, this caused an UndefinedError in
Jinja2 3.x (which no longer silently returns Undefined for missing
dict keys).
Additionally, the condition only handled string values for gzip, but
the defaults document gzip can be a number (e.g., 'gzip: 5'). The
condition now also accepts numeric types.
Fixes: log['access']['gzip'] -> log['gzip']
Adds: (log['gzip'] is string or log['gzip'] is number)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inside the 'log' macro, the template iterates over log['access'] entries using '{% for log in log['access'] %}'. Within this loop, each 'log' is an individual access log entry dict with keys: path, format, buffer, gzip, flush, if.
The gzip conditional on line 193 (http) / line 65 (stream) contained a typo: it accessed log['access']['gzip'] instead of log['gzip']. Since entry dicts have no 'access' key, this caused an UndefinedError in Jinja2 3.x (which no longer silently returns Undefined for missing dict keys).
Additionally, the condition only handled string values for gzip, but the defaults document gzip can be a number (e.g., 'gzip: 5'). The condition now also accepts numeric types.
Fixes: log['access']['gzip'] -> log['gzip']
Adds: (log['gzip'] is string or log['gzip'] is number)
Proposed changes
Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to that issue using one of the supported keywords in this PR's description or commit message.
Checklist
Before creating a PR, run through this checklist and mark each as complete:
defaults/main/*.yml,README.mdandCHANGELOG.md).