haiwen / seahub

The web end of seafile server.
seafile.com
Other
526 stars 369 forks source link

Thumbnail (thumbnail_src) does not consider SITE_ROOT settings #418

Closed m33x closed 5 years ago

m33x commented 9 years ago

Hi,

my Seafile instance does not run on https://example.org but instead on https://example.org/sea/

This can be accomplished by settings the

SITE_ROOT = '/sea/'

in the seahub_settings.py file.

However, thumbnails do not work anymore, because /seahub/thumbnail/utils.py needs to be changed from this

import posixpath
from seahub.utils import get_service_url
def get_thumbnail_src(repo_id, obj_id, size):
    return posixpath.join(get_service_url(), "thumbnail", repo_id,
                          obj_id, size)

to

import posixpath
from seahub.utils import get_service_url
def get_thumbnail_src(repo_id, obj_id, size):
    return posixpath.join(get_service_url(), "/sea/thumbnail", repo_id,
                          obj_id, size)

Of course we need a generic solution for this, because hard coding the folder in this file isn't a great idea.

lins05 commented 9 years ago

Set SERVICE_URL to https://example.com/sea, restart seahub and it should work fine.

On Wed, Mar 18, 2015 at 6:39 PM, m33x notifications@github.com wrote:

Hi,

my Seafile instance does not run on https://example.org but instead on https://example.org/sea/

This can be accomplished by settings the

SITE_ROOT = '/sea/'

in the seahub_settings.py file.

However, thumbnails do not work anymore, because /seahub/thumbnail/utils.py needs to be changed from this

import posixpath from seahub.utils import get_service_url def get_thumbnail_src(repo_id, obj_id, size): return posixpath.join(get_service_url(), "thumbnail", repo_id, obj_id, size)

to

import posixpath from seahub.utils import get_service_url def get_thumbnail_src(repo_id, obj_id, size): return posixpath.join(get_service_url(), "/sea/thumbnail", repo_id, obj_id, size)

Of course we need a generic solution for this, because hard coding the folder in this file isn't a great idea.

— Reply to this email directly or view it on GitHub https://github.com/haiwen/seahub/issues/418.

m33x commented 9 years ago

Nope, this did not fix it. Your suggested solution via SERVICE_URL does not work. In Chrome we can see in the developer tools:

<img class="thumbnail" src="https://example.org/thumbnail/c3a5003e-5ef2-4f7a-ac3f-346c8255a092/9c539c9d2fceca79e7a7b053d57a412879fa6b8c/24" alt="Datei">

but correct would be

<img class="thumbnail" src="https://example.org/sea/thumbnail/c3a5003e-5ef2-4f7a-ac3f-346c8255a092/9c539c9d2fceca79e7a7b053d57a412879fa6b8c/24" alt="Datei">

here are my settings

SERVICE_URL = 'https://example.org/sea'
FILE_SERVER_ROOT = 'https://example.org/seafhttp'
SITE_BASE = 'https://example.org'
SITE_NAME = 'example.org'
SITE_ROOT = '/sea/'
cmusik commented 9 years ago

@m33x you have to set SERVICE_URL in ccnet/ccnet.conf

freeplant commented 5 years ago

The issue is outdated.