Cannot create share links with passwords

Hi all,

i’ve searched the topics but could not find anything with the problem in question in the subject of this topic.

  • When i try to create a share link with a password all i get is a small message on top “Error” (screenshot bellow).

  • In the seahub.log i see this after each try:

[ERROR] django.request:224 log_response Internal Server Error: /api/v2.1/share-links/
Traceback (most recent call last):
File “/srv/seafile/seahub/thirdpart/django/core/handlers/exception.py”, line 47, in inner
response = get_response(request)
File “/srv/seafile/seahub/thirdpart/django/core/handlers/base.py”, line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/srv/seafile/seahub/thirdpart/django/views/decorators/csrf.py”, line 54, in wrapped_view
return view_func(*args, **kwargs)
File “/srv/seafile/seahub/thirdpart/django/views/generic/base.py”, line 70, in view
return self.dispatch(request, *args, **kwargs)
File “/srv/seafile/seahub/thirdpart/rest_framework/views.py”, line 505, in dispatch
response = self.handle_exception(exc)
File “/srv/seafile/seahub/thirdpart/rest_framework/views.py”, line 465, in handle_exception
self.raise_uncaught_exception(exc)
File “/srv/seafile/seahub/thirdpart/rest_framework/views.py”, line 476, in raise_uncaught_exception
raise exc
File “/srv/seafile/seahub/thirdpart/rest_framework/views.py”, line 502, in dispatch
response = handler(request, *args, **kwargs)
File “/srv/seafile/seahub/seahub/api2/endpoints/share_links.py”, line 410, in post
fs = FileShare.objects.create_file_link(username, repo_id, path,
File “/srv/seafile/seahub/seahub/share/models.py”, line 157, in create_file_link
return self._add_file_share(username, repo_id, path, ‘f’, password,
File “/srv/seafile/seahub/seahub/share/models.py”, line 110, in _add_file_share
password_enc = make_password(password)
File “/srv/seafile/seahub/seahub/share/models.py”, line 31, in make_password
aes = AESPasswordHasher()
File “/srv/seafile/seahub/seahub/utils/hasher.py”, line 39, in init
self.cipher = AES.new(secret.encode(‘utf-8’), AES.MODE_ECB)
AttributeError: ‘NoneType’ object has no attribute ‘new’

Everything else on the seafile installation works as designed.

Seafile “version”: “9.0.2” is running on Ubuntu 20.04.3 LTS

I could use some help :slight_smile:

1 Like

Hi guys!

I have the same issue, also in a freshly created test-environment. I’m running Ubuntu 22.04 LTS and Seafile 9.0.5 with nginx.

Poduction:

2022-05-25 06:09:46,311 [ERROR] django.request:224 log_response Internal Server Error: /api/v2.1/share-links/
Traceback (most recent call last):
  File "/srv/seafile/seahub/thirdpart/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
  File "/srv/seafile/seahub/thirdpart/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/srv/seafile/seahub/thirdpart/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
  File "/srv/seafile/seahub/thirdpart/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
  File "/srv/seafile/seahub/thirdpart/rest_framework/views.py", line 505, in dispatch
response = self.handle_exception(exc)
  File "/srv/seafile/seahub/thirdpart/rest_framework/views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
  File "/srv/seafile/seahub/thirdpart/rest_framework/views.py", line 476, in raise_uncaught_exception
raise exc
  File "/srv/seafile/seahub/thirdpart/rest_framework/views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
  File "/srv/seafile/seahub/seahub/api2/endpoints/share_links.py", line 410, in post
fs = FileShare.objects.create_file_link(username, repo_id, path,
  File "/srv/seafile/seahub/seahub/share/models.py", line 157, in create_file_link
return self._add_file_share(username, repo_id, path, 'f', password,
  File "/srv/seafile/seahub/seahub/share/models.py", line 110, in _add_file_share
password_enc = make_password(password)
  File "/srv/seafile/seahub/seahub/share/models.py", line 31, in make_password
aes = AESPasswordHasher()
  File "/srv/seafile/seahub/seahub/utils/hasher.py", line 39, in __init__
self.cipher = AES.new(secret.encode('utf-8'), AES.MODE_ECB)
AttributeError: 'NoneType' object has no attribute 'new'

Test:

2022-05-25 12:35:08,903 [ERROR] django.request:224 log_response Internal Server Error: /api/v2.1/share-links/
Traceback (most recent call last):
File “/srv/seafile/seahub/thirdpart/django/core/handlers/exception.py”, line 47, in inner
response = get_response(request)
File “/srv/seafile/seahub/thirdpart/django/core/handlers/base.py”, line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/srv/seafile/seahub/thirdpart/django/views/decorators/csrf.py”, line 54, in wrapped_view
return view_func(*args, **kwargs)
File “/srv/seafile/seahub/thirdpart/django/views/generic/base.py”, line 70, in view
return self.dispatch(request, *args, **kwargs)
File “/srv/seafile/seahub/thirdpart/rest_framework/views.py”, line 505, in dispatch
response = self.handle_exception(exc)
File “/srv/seafile/seahub/thirdpart/rest_framework/views.py”, line 465, in handle_exception
self.raise_uncaught_exception(exc)
File “/srv/seafile/seahub/thirdpart/rest_framework/views.py”, line 476, in raise_uncaught_exception
raise exc
File “/srv/seafile/seahub/thirdpart/rest_framework/views.py”, line 502, in dispatch
response = handler(request, *args, **kwargs)
File “/srv/seafile/seahub/seahub/api2/endpoints/share_links.py”, line 413, in post
fs = FileShare.objects.create_file_link(username, repo_id, path,
File “/srv/seafile/seahub/seahub/share/models.py”, line 157, in create_file_link
return self._add_file_share(username, repo_id, path, ‘f’, password,
File “/srv/seafile/seahub/seahub/share/models.py”, line 110, in _add_file_share
password_enc = make_password(password)
File “/srv/seafile/seahub/seahub/share/models.py”, line 31, in make_password
aes = AESPasswordHasher()
File “/srv/seafile/seahub/seahub/utils/hasher.py”, line 39, in init
self.cipher = AES.new(secret.encode(‘utf-8’), AES.MODE_ECB)
AttributeError: ‘NoneType’ object has no attribute ‘new’

Does someone have an idea where we should look or maybe try some things?

Thank you very much in advance!

1 Like

While playing around with the Test system i found out that it may be related with dependencies.

Can you check what Django and cffi version you’re running?

For django:

pip list | grep Django

and for cffi i just checked in the filesystem under

/“YourCustomPath”/seafile/seahub/thirdpart

there should be a cffi folder with a version.

With installing the correct versions I was able to fix it in the Test environment.

For the django installation i used:

pip3 install django==3.2.* Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 django-pylibmc django-simple-captcha python3-ldap mysqlclient pycryptodome==3.12.0

and for cffi:

pip3 install --force-reinstall --upgrade --target /srv/seafile/seahub/thirdpart cffi==1.14.6

as mentioned in another thread by @Barolo - Thank you!

Hope this helps - i’ll also update when I was able to do the productive environment.

@gi4ouR did my details help you in any way or are you still stuck with the error?