Skip to content

Commit

Permalink
Disable cache for report helpers (#6370) (#6371)
Browse files Browse the repository at this point in the history
- Can lead to unintended consequences where REPORT_DEBUG_MODE toggles

(cherry picked from commit 2557383)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
  • Loading branch information
github-actions[bot] and SchrodingersGat committed Jan 31, 2024
1 parent fc4e20f commit a05e07b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions InvenTree/report/templatetags/report.py
Expand Up @@ -86,7 +86,7 @@ def asset(filename):
filename = '' + filename

# If in debug mode, return URL to the image, not a local file
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE')
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE', cache=False)

# Test if the file actually exists
full_path = settings.MEDIA_ROOT.joinpath('report', 'assets', filename).resolve()
Expand Down Expand Up @@ -124,7 +124,7 @@ def uploaded_image(filename, replace_missing=True, replacement_file='blank_image
filename = '' + filename

# If in debug mode, return URL to the image, not a local file
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE')
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE', cache=False)

# Check if the file exists
if not filename:
Expand Down Expand Up @@ -286,7 +286,7 @@ def logo_image(**kwargs):
- Otherwise, return a path to the default InvenTree logo
"""
# If in debug mode, return URL to the image, not a local file
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE')
debug_mode = InvenTreeSetting.get_setting('REPORT_DEBUG_MODE', cache=False)

return InvenTree.helpers.getLogoImage(as_file=not debug_mode, **kwargs)

Expand Down

0 comments on commit a05e07b

Please sign in to comment.