Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate body content in the production log #1377

Merged
merged 3 commits into from
Jan 20, 2025
Merged

Conversation

melroy89
Copy link
Member

@melroy89 melroy89 commented Jan 17, 2025

Stops dumping the whole HTML page into the production log.

It now should now truncate the content (similar to what we do at other places) and also give a better warning message as well, since the message was not empty but invalid JSON.

I also do not json_encode this body. As you can see above, this doesn't seems to work out very well. Should we encode this? I think we shouldn't.

Before:

{"message":"[ActivityHandler::doWork] Activity message from was empty: \"<!DOCTYPE html>\\n<html lang=\\\"en\\\" dir=\\\"ltr\\\" data-critters-container>\\n  <head>\\n    <meta charset=\\\"UTF-8\\\">\\n    <meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1\\\">\\n\\n    <meta name=\\\"theme-color\\\" content=\\\"#fff\\\">\\n    <meta property=\\\"og:platform\\\" content=\\\"PeerTube\\\">\\n    <!-- Web Manifest file -->\\n    <link rel=\\\"manifest\\\" href=\\\"\\/manifest.webmanifest?4c8fd744881396dcfe1523d39ab99685121e6e1a\\\">\\n\\n    <link rel=\\\"icon\\\" type=\\\"image\\/png\\\" href=\\\"\\/client\\/assets\\/images\\/favicon.png?2ad41d22c0e341b2d933fd24387cede77d2e2c55\\\">\\n    <link rel=\\\"apple-touch-icon\\\" href=\\\"\\/client\\/assets\\/images\\/icons\\/icon-144x144.png\\\" sizes=\\\"144x144\\\">\\n    <link rel=\\\"apple-touch-icon\\\" href=\\\"\\/client\\/assets\\/images\\/icons\\/icon-192x192.png\\\" sizes=\\\"192x192\\\">\\n\\n    <!-- logo background-image -->\\n    <style type=\\\"text\\/css\\\">\\n      .icon-logo {\\n        background-image: url(\\/client\\/assets\\/images\\/logo.svg?b08484358edad4fa10af4098f76e1c1a96b7ae09);\\n      }\\n    <\\/style>\\n\\n    <!-- base url -->\\n    <base href=\\\"\\/client\\/en-US\\/\\\">\\n\\n    <!-- \\/!\\\\ The following comment is used by the server to prerender some tags \\/!\\\\ -->\\n\\n    <title>peertube - BrooksTube<\
.................................
.................................
\n      }\\n\\n      if (\\/MSIE|Trident\\/.test(window.navigator.userAgent) ) {\\n        displayIncompatibleBrowser()\\n      }\\n    <\\/script>\\n\\n    <my-app>\\n    <\\/my-app>\\n\\n  <script src=\\\"runtime.edd0f45dd39b5dad.js\\\" type=\\\"module\\\"><\\/script><script src=\\\"polyfills.3093862582b2ff13.js\\\" type=\\\"module\\\"><\\/script><script src=\\\"main.a19e9b79562e194c.js\\\" type=\\\"module\\\"><\\/script><\\/body>\\n<\\/html>\\n\"
},
"level":300,"level_name":"WARNING","channel":"app","datetime":"2025-01-18T02:44:56.294739+01:00","extra":{}}

@melroy89 melroy89 added the enhancement New feature or request label Jan 17, 2025
@melroy89 melroy89 added this to the v1.8.0 milestone Jan 17, 2025
@melroy89 melroy89 requested a review from BentiGorlich January 17, 2025 22:53
@melroy89 melroy89 enabled auto-merge (squash) January 18, 2025 16:06
@melroy89 melroy89 merged commit 1ed1e53 into main Jan 20, 2025
7 checks passed
@melroy89 melroy89 deleted the truncate_warning_payload branch January 20, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants