Internal link not working on folders

hi,

when creating an internal link on a folder, it doesn’t work.
All we get is an internal server error (“500”) in seahub.access.log and an error page in the browser.

same behavior with Seafile Server 8.0.4 and 8.0.7

is this a bug or a configuration issue?

regards,
Reinhard

Welcome to the Seafile Community Forum!

With Seafile Professional Edition 8.0.5 on Ubuntu 20.04 (manual installation) with MySQL, internal links for folders work just the way they should.

if it works on Ubuntu, it might be a problem specific to CentOS, as issue #4752 ([Bug] pysearpc.common.SearpcError: invalid path · Issue #4752 · haiwen/seahub · GitHub) describes the same problem on CentOS

our setup:
Seafile 8.0.7 (community edition), CentOS 7.9, MariaDB 5.5.68, Python 3.6.8
(mariadb-server-5.5.68-1.el7.x86_64 python3-3.6.8-18.el7.x86_64, the versions that come with CentOS 7.x)

what we do:

  • create a library with user1
  • add a folder to that library
  • give user2 read/write permission to that folder
  • copy the internal smart link of the folder
  • open the smart link with user2
    → result: error page in Browser, internal server error (“500”) in seahub.access.log, and “pysearpc.common.SearpcError: invalid path” in seahub.log

seahub.log:
2021-08-19 11:45:49,200 [ERROR] django.request:228 log_response Internal Server Error: /library/8f1b66f2-44af-487e-99cc-bada982bf872/Meine Bibliothek/test
Traceback (most recent call last):
File “/export/htdocs/PD-Share/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/exception.py”, line 34, in inner
response = get_response(request)
File “/export/htdocs/PD-Share/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/base.py”, line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/export/htdocs/PD-Share/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/base.py”, line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/export/htdocs/PD-Share/seafile-server-8.0.7/seahub/seahub/auth/decorators.py”, line 27, in _wrapped_view
return view_func(request, *args, **kwargs)
File “/export/htdocs/PD-Share/seafile-server-8.0.7/seahub/seahub/views/init.py”, line 1142, in react_fake_view
#if not seafile_api.get_dirent_by_path(converted_repo_id, converted_path):
File “/export/htdocs/PD-Share/seafile-server-8.0.7/seafile/lib64/python3.6/site-packages/seaserv/api.py”, line 216, in get_dirent_by_path
return seafserv_threaded_rpc.get_dirent_by_path(repo_id, path)
File “/export/htdocs/PD-Share/seafile-server-8.0.7/seafile/lib64/python3.6/site-packages/pysearpc/client.py”, line 128, in newfunc
return fret(ret_str)
File “/export/htdocs/PD-Share/seafile-server-8.0.7/seafile/lib64/python3.6/site-packages/pysearpc/client.py”, line 66, in _fret_obj
raise SearpcError(dicts[‘err_msg’])
pysearpc.common.SearpcError: invalid path

and as described in issue #4752, if I disable the seafile_api.get_dirent_by_path check in seahub/views/__init__.py:react_fake_view everything works fine

any ideas what ist causing this problem?

I can confirm this is not working.
Same use case for me as in the github issue: “Share folder in library that is not shared”
It is working for files though.

Following the exact same steps as @reinhard produces the exact same issue for me.
I can open the magic link as the owner of the folder and it resolves fine, but if I share it with a user, they cannot use the internal magic link.

Seafile Version: 8.0.7
OS: Docker
Container: seafileltd/seafile-mc

I don’t really think this is related to the operating system, because it should work when using the official seafile docker image.

Trace is the same:

2021-08-22 17:49:09,211 [ERROR] django.request:222 log_response Internal Server Error: /library/1b3da1f0-17cf-41fc-95dd-abb22561d14e/My Library/Test
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/seafile/seafile-server-8.0.7/seahub/seahub/auth/decorators.py", line 27, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-8.0.7/seahub/seahub/views/__init__.py", line 1142, in react_fake_view
    if not seafile_api.get_dirent_by_path(converted_repo_id, converted_path):
  File "/opt/seafile/seafile-server-8.0.7/seafile/lib64/python3.6/site-packages/seaserv/api.py", line 216, in get_dirent_by_path
    return seafserv_threaded_rpc.get_dirent_by_path(repo_id, path)
  File "/opt/seafile/seafile-server-8.0.7/seafile/lib64/python3.6/site-packages/pysearpc/client.py", line 128, in newfunc
    return fret(ret_str)
  File "/opt/seafile/seafile-server-8.0.7/seafile/lib64/python3.6/site-packages/pysearpc/client.py", line 66, in _fret_obj
    raise SearpcError(dicts['err_msg'])
pysearpc.common.SearpcError: invalid path

I am not using Docker. May be a Docker issue.

We have the same issue with seafile 7.1.18.
I found that the link only works if the user you give the smartlink have rights on the parent directory (read rights minimum).
But if you give the right on the directory you give the smartlink an error is generated.
I don’t know if you have the same behavior ?

Best regards,

Sébastien Finkbeiner

Hello.

Thanks for reporting this bug, we will fix it in the next 9.0.x version.

Hello,

We deployed Seafile Release 9.0.4 and it seems the bug is always present.
Internal link seems to be a good idea for users but is actually unusable.

Thanks.