Error in seahub when accessing group shares

Running Seafile 7.0.4 on a Raspberry Pi, the Seahub Web UI shows an Error when clicking on “Shared with Groups” and then selecting one of the groups (i.e., the URL my-seafile-server.tld/group/1/ (or a different number)).

It works, if I select “All groups” instead of a specific one.

seahub.log logs the following error:

2019-08-05 15:21:00,647 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api/v2.1/groups/3/libraries/
Traceback (most recent call last):
  File "/home/seafile/seafile-server-7.0.4/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/seafile/seafile-server-7.0.4/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/seafile/seafile-server-7.0.4/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/seafile/seafile-server-7.0.4/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/seafile/seafile-server-7.0.4/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/seafile/seafile-server-7.0.4/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.4/seahub/thirdpart/djangorestframework-3.3.3-py2.7.egg/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/home/seafile/seafile-server-7.0.4/seahub/thirdpart/djangorestframework-3.3.3-py2.7.egg/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.4/seahub/seahub/api2/endpoints/utils.py", line 42, in _decorated
    return func(view, request, group_id, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.4/seahub/seahub/api2/endpoints/group_libraries.py", line 106, in get
    if '@seafile_group' in email:
TypeError: argument of type 'NoneType' is not iterable

Thanks for fixing!

1 Like

Do you see any error messages in ccnet.log and seafile.log?

No, there are no error messages in these or any other log files.

I have the same problem. Are there any news about this?

Gruß, Jörg

I can confirm, I have same issue.

@Jonathan The error is only reported on the Seahub GUI and on seahub.log. No logging either on seafile.log nor ccnet.log

This only happens by clicking on the specific group. Clicking in “all groups” tab appear the libraries but with wrong creation time (before 50 years = 1. January 1970).

I got the same error for version 7.0.5. It was apparently introduced between 6.3.4 and 7.0.3.
The reason for this is probably an incomplete output of the get_repos_by_group method.
Many of the attributes of the returned repositories are missing. One of them is the last_modifier.

A possible workaround for me was:

  1. Edit the file seafile-server-latest/seahub/seahub/api2/endpoints/group_libraries.py:
    • remove / comment line 97:
      all_modifier = [r.last_modifier for r in group_repos]
    • edit line 103:
      for email in all_repo_owner:
      instead of
      for email in set(all_repo_owner + all_modifier)
    • edit line 135:
      modifier = repo_owner
      instead of
      modifier = group_repo.last_modifier
  2. remove file (it will be automatically recompiled) seafile-server-latest/seahub/seahub/api2/endpoints/group_libraries.pyc
  3. restart seahub (this will recompile the edited file)

This will replace the missing last_modifier with the repo owner. I actually don’t know if the modifier attribute is used somewhere, but it works.

It should now display the group repositories as expected, even if the last-modified date is still displayed as 50 years.

Hope this helps!

1 Like

Hey, thanks for your workaround. It works for me but I adapted the code changes a little bit to keep the changes together.

    # get repo id owner dict
    all_repo_owner = []
    all_modifier = [] # Hack for last_modifier
    repo_id_owner_dict = {}
    for repo in group_repos:
        repo_id = repo.id
        if repo_id not in repo_id_owner_dict:
            repo_owner = get_repo_owner(request, repo_id)
            all_repo_owner.append(repo_owner)
            repo_id_owner_dict[repo_id] = repo_owner

        # Hack for last_modifier
        if repo.last_modifier is None:
            all_modifier.append(repo_owner)
        else:
            all_modifier.append(last_modifier)
    # all_modifier = [r.last_modifier for r in group_repos]
...
1 Like

Fantastic, thanks @nheller and @fweisser!
Could you please open a PR in the github repo, so everyone benefits from your patch? Thanks!

I opened a PR with your patch, @nheller.
Actually, your patch results in a failing test which is why I now proposed the patch from @fweisser in the PR.

2 Likes

Thank you for making the PR!