1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +00:00

fix custom org logo bug when enable AVATAR_FILE_STORAGE (#5703)

This commit is contained in:
lian
2023-10-24 14:09:57 +08:00
committed by GitHub
parent 2a82e10c6f
commit a206b5114c
5 changed files with 15 additions and 6 deletions

View File

@@ -17,7 +17,7 @@ class Logo extends React.Component {
return (
<div className="top-logo">
<a href={siteRoot} id="logo">
<img src={mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" />
<img src={logoPath.indexOf('image-view') != -1 ? logoPath : mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" />
</a>
{this.props.showCloseSidePanelIcon &&
<a

View File

@@ -20,7 +20,7 @@ class OrgWebSettings extends Component {
loading: true,
errorMsg: '',
config_dict: null,
logoPath: mediaUrl + logoPath,
logoPath: logoPath,
file_ext_white_list: '',
};
}
@@ -55,7 +55,7 @@ class OrgWebSettings extends Component {
updateLogo = (file) => {
seafileAPI.orgAdminUpdateLogo(orgID, file).then((res) => {
this.setState({
logoPath: mediaUrl + res.data.logo_path
logoPath: res.data.logo_path
});
toaster.success(gettext('Success'));
}).catch((error) => {
@@ -77,7 +77,9 @@ class OrgWebSettings extends Component {
}
render() {
const { loading, errorMsg, config_dict, logoPath, file_ext_white_list } = this.state;
const { loading, errorMsg, config_dict, file_ext_white_list } = this.state;
let logoPath = this.state.logoPath;
logoPath = logoPath.indexOf('image-view') != -1 ? logoPath : mediaUrl + logoPath;
return (
<Fragment>
<MainPanelTopbar {...this.props} />

View File

@@ -95,6 +95,9 @@ def base(request):
org_logo_url = OrgAdminSettings.objects.get_org_logo_url(org.org_id)
if org_logo_url:
logo_path = org_logo_url
from seahub.avatar.settings import AVATAR_FILE_STORAGE
if AVATAR_FILE_STORAGE == 'seahub.base.database_storage.DatabaseStorage':
logo_path = "/image-view/" + logo_path
# get favicon path
custom_favicon_file = os.path.join(MEDIA_ROOT, CUSTOM_FAVICON_PATH)

View File

@@ -71,4 +71,8 @@ class OrgAdminLogo(APIView):
logger.error(e)
return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, 'Internal Server Error')
from seahub.avatar.settings import AVATAR_FILE_STORAGE
if AVATAR_FILE_STORAGE == 'seahub.base.database_storage.DatabaseStorage':
org_logo_url = "/image-view/" + org_logo_url
return Response({'logo_path': org_logo_url})

View File

@@ -16,4 +16,4 @@ ORG_AUTO_URL_PREFIX = getattr(settings, 'ORG_AUTO_URL_PREFIX', True)
ORG_ENABLE_ADMIN_INVITE_USER = getattr(settings, 'ORG_ENABLE_ADMIN_INVITE_USER', False)
ORG_ENABLE_ADMIN_CUSTOM_NAME = getattr(settings, 'ORG_ENABLE_ADMIN_CUSTOM_NAME', True)
ORG_ENABLE_ADMIN_CUSTOM_LOGO = getattr(settings, 'ORG_ENABLE_ADMIN_CUSTOM_LOGO', False)
ORG_ENABLE_ADMIN_CUSTOM_LOGO = getattr(settings, 'ORG_ENABLE_ADMIN_CUSTOM_LOGO', True)