-
Notifications
You must be signed in to change notification settings - Fork 88
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
AttributeError at /api/v1/timelines/public 'NoneType' object has no attribute 'replace' #610
Comments
Looks like you somehow have a post with no content. Let me add a good escape handler for that. |
Hmm, what version of the code are you running? That traceback matches neither 0.9.0 or main, both of which seem to have defences against this. |
Well that’s odd! I’m on 0.9.0…should I grab a fuller dump or re-pull? |
Are you able to get into your system and see what line 178 of |
Hrm, so the webserver and runner server are both running jointakahe/takahe:latest. The containers have been nicely "minified" so vi, vim, nano aren't present, so not sure how to get to the exact line we need. Did a |
You can just use Also busybox is in there, so I believe |
slick! root@takahe-serve:/takahe/core# cat html.py | head -n 180 | tail -n 4
root@takahe-serve:/takahe/core# |
Well I don't know what version you have but it definitely isn't the latest image and I cannot for the life of me figure out what version it would be. What does your |
root@takahe-serve:/takahe/takahe# cat init.py Should I try to re-pull the images? This is my image from docker: sha256:f28d55e609a9288e18914523c38c7207c5bab169a8f93c2b819a315dc927702a |
Are you pulling it from docker |
let me try a new "pull" just for giggles (shrug) |
:/ |
Yeah, I don't know what's happening here, but it's definitely not pulling actual |
Well that is incredibly strange. I also pulled the image to my local system and got a different SHA, even when pulling by SHA itself:
I am not quite sure what's going on here, but I can verify that the image I pulled as 0.9.0 has this on lines 177 - 180:
What do you see in the explicitly pulled |
This also happens on Takahe 0.10.1 on the Tags page.
|
Got about 70 of these over the course of an hour this morning.
Let me know if you need more of the dump - trying to be careful with the securestrings
Partial dump:
Request Method: GET
Request URL: http://url2836.thedoodleproject.net/ls/click?upn=E-2BIWnGoNaV1xc2v5aE-2B4Gzx6BY1Kbt5iQDnHCgHyWoX1QPkgRbuoixoHLDdTkMS2nLs45NGjO8Eo5LlRGdCm6Ym3uOJr3UJa-2FtSZ1CQP7-2Bk-3Dz8aE_MTQKioXqYBjSf6sZsbopRxXOuEG0ZOkr5NI5G2u0JGvp4JLCMa-2FFTbuuKL-2FB4dNYxIfTBSHCYd8P-2BEaAIfLCpYDIEXVDzTXlsE9-2BfudeAHeaLnsEvE79YMzUy3Nq9AA-2FvSVWpa-2FuBxB0ewglfrgLo98PRJT9OaKFg8eTmDQIWiPHRWLNJsYVlD6k6-2BQLhkrjdlQiEH9oNXI-2BjuGf26g00IxEmMLdnX4obkNu6e1o41Q-3D
Django Version: 4.2.2
Python Executable: /usr/local/bin/python3
Python Version: 3.11.4
Python Path: ['/takahe', '/usr/local/bin', '/usr/local/lib/python311.zip', '/usr/local/lib/python3.11', '/usr/local/lib/python3.11/lib-dynload', '/usr/local/lib/python3.11/site-packages']
Server time: Mon, 17 Jul 2023 09:27:44 +0000
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.postgres',
'corsheaders',
'django_htmx',
'hatchway',
'core',
'activities',
'api',
'mediaproxy',
'stator',
'users']
Installed Middleware:
['core.middleware.SentryTaggingMiddleware',
'django.middleware.security.SecurityMiddleware',
'corsheaders.middleware.CorsMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_htmx.middleware.HtmxMiddleware',
'core.middleware.HeadersMiddleware',
'core.middleware.ConfigLoadingMiddleware',
'api.middleware.ApiTokenMiddleware',
'users.middleware.DomainMiddleware']
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hatchway/view.py", line 302, in call
response = self.view(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/takahe/api/views/timelines.py", line 84, in public
schemas.Status.map_from_post(pager.results, request.identity),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/takahe/api/schemas.py", line 189, in map_from_post
return [
File "/takahe/api/schemas.py", line 190, in
cls.from_post(
^
File "/takahe/api/schemas.py", line 172, in from_post
**post.to_mastodon_json(
File "/takahe/activities/models/post.py", line 1113, in to_mastodon_json
"content": self.safe_content_remote(),
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/takahe/activities/models/post.py", line 430, in safe_content_remote
return self.safe_content(local=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/takahe/activities/models/post.py", line 417, in safe_content
return func(local=local)
^^^^^^^^^^^^^^^^^
File "/takahe/activities/models/post.py", line 385, in _safe_content_note
return ContentRenderer(local=local).render_post(self.content, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/takahe/core/html.py", line 338, in render_post
parser = FediverseHtmlParser(
File "/takahe/core/html.py", line 81, in init
self.feed(html.replace("\n", ""))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/html/parser.py", line 110, in feed
self.goahead(0)
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/html/parser.py", line 172, in goahead
k = self.parse_endtag(i)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/html/parser.py", line 413, in parse_endtag
self.handle_endtag(elem)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/takahe/core/html.py", line 138, in handle_endtag
self.html_output += self.create_link(
File "/takahe/core/html.py", line 178, in create_link
return f'{html.escape(content)}'
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/html/init.py", line 19, in escape
s = s.replace("&", "&") # Must be done first!
^^^^^^^^^
Exception Type: AttributeError at /api/v1/timelines/public
Exception Value: 'NoneType' object has no attribute 'replace'
Raised during: hatchway.view.ApiView
Request information:
USER: AnonymousUser
GET:
limit = '40'
POST: No POST data
FILES: No FILES data
COOKIES: No cookie data
The text was updated successfully, but these errors were encountered: