Skip to content

Commit

Permalink
Merge branch 'rendering-error' into 'main'
Browse files Browse the repository at this point in the history
Force chromium offline mode

See merge request reportcreator/reportcreator!666
  • Loading branch information
MWedl committed Aug 26, 2024
2 parents f7a75d9 + 4462eb4 commit 1b5ef54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* More settings for guest user permissions: GUEST_USERS_CAN_EDIT_PROJECTS, GUEST_USERS_CAN_SEE_ALL_USERS
* Improve error messages for decryption errors
* Fix checkboxes not rendered as checked in PDF
* Fix chromium error while rendering PDFs


## v2024.63 - 2024-08-07
Expand Down
7 changes: 3 additions & 4 deletions api/src/reportcreator_api/tasks/rendering/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_page():
) as browser:
with browser.new_context(
base_url=FAKE_BASE_URL,
offline=False, # Offline mode prevents request mocking. A catch-all route handler is used instead
offline=True,
java_script_enabled=True,
service_workers='block',
accept_downloads=False,
Expand Down Expand Up @@ -138,7 +138,7 @@ def chromium_request_handler(route):
)))

# Catch all requests
page.route('**', chromium_request_handler)
page.route('**/*', chromium_request_handler)

# Load Vue template
page.route(FAKE_BASE_URL + '/', lambda route: route.fulfill(content_type='text/html', body=''))
Expand Down Expand Up @@ -182,8 +182,7 @@ def chromium_request_handler(route):
}
if msg['message'] in [
'[Vue warn]: Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.',
'Failed to load resource: net::ERR_FAILED',
]:
] or msg['message'].startswith('Failed to load resource: net::'):
continue
if msg['level'] not in ['error', 'warning', 'info']:
msg['level'] = 'info'
Expand Down

0 comments on commit 1b5ef54

Please sign in to comment.