diff --git a/frontend/src/components/file-content-view/image.js b/frontend/src/components/file-content-view/image.js
index 2c68da75d7..c1418c2768 100644
--- a/frontend/src/components/file-content-view/image.js
+++ b/frontend/src/components/file-content-view/image.js
@@ -55,7 +55,7 @@ class FileContent extends React.Component {
// only for 'file view'. not for 'history/trash file view'
let thumbnailURL = '';
const fileExtList = ['tif', 'tiff', 'psd'];
- if (this.props.canUseThumbnail && !repoEncrypted && fileExtList.includes(fileExt)) {
+ if (!repoEncrypted && fileExtList.includes(fileExt)) {
thumbnailURL = `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${Utils.encodePath(filePath)}`;
}
diff --git a/frontend/src/file-view.js b/frontend/src/file-view.js
index bc4a67970c..3178b0a531 100644
--- a/frontend/src/file-view.js
+++ b/frontend/src/file-view.js
@@ -24,7 +24,7 @@ class InnerFileView extends React.Component {
let content;
switch (fileType) {
case 'Image':
- content = } canUseThumbnail={true} />;
+ content = } />;
break;
case 'XMind':
content = } />;
diff --git a/seahub/api2/endpoints/dir.py b/seahub/api2/endpoints/dir.py
index cdf908ecee..15e49c3a56 100644
--- a/seahub/api2/endpoints/dir.py
+++ b/seahub/api2/endpoints/dir.py
@@ -27,8 +27,7 @@ from seahub.base.models import UserStarredFiles
from seahub.base.templatetags.seahub_tags import email2nickname, \
email2contact_email
-from seahub.settings import ENABLE_THUMBNAIL, ENABLE_VIDEO_THUMBNAIL, \
- THUMBNAIL_ROOT
+from seahub.settings import ENABLE_VIDEO_THUMBNAIL, THUMBNAIL_ROOT
from seaserv import seafile_api
from pysearpc import SearpcError
@@ -145,7 +144,7 @@ def get_dir_file_info_list(username, request_type, repo_obj, parent_dir,
file_info['file_tags'].append(file_tag)
# get thumbnail info
- if ENABLE_THUMBNAIL and with_thumbnail and not repo_obj.encrypted:
+ if with_thumbnail and not repo_obj.encrypted:
# used for providing a way to determine
# if send a request to create thumbnail.
diff --git a/seahub/api2/endpoints/share_links.py b/seahub/api2/endpoints/share_links.py
index 351b470283..ca14c52ac6 100644
--- a/seahub/api2/endpoints/share_links.py
+++ b/seahub/api2/endpoints/share_links.py
@@ -42,7 +42,7 @@ from seahub.thumbnail.utils import get_share_link_thumbnail_src
from seahub.settings import SHARE_LINK_EXPIRE_DAYS_MAX, \
SHARE_LINK_EXPIRE_DAYS_MIN, SHARE_LINK_LOGIN_REQUIRED, \
SHARE_LINK_EXPIRE_DAYS_DEFAULT, \
- ENABLE_SHARE_LINK_AUDIT, ENABLE_THUMBNAIL, ENABLE_VIDEO_THUMBNAIL, \
+ ENABLE_SHARE_LINK_AUDIT, ENABLE_VIDEO_THUMBNAIL, \
THUMBNAIL_ROOT, ENABLE_UPLOAD_LINK_VIRUS_CHECK
from seahub.wiki.models import Wiki
from seahub.views.file import can_edit_file
@@ -729,9 +729,8 @@ class ShareLinkDirents(APIView):
dirent_info['file_name'] = dirent.obj_name
file_type, file_ext = get_file_type_and_ext(dirent.obj_name)
- if ENABLE_THUMBNAIL and \
- (file_type in (IMAGE, XMIND) or \
- (file_type == VIDEO and ENABLE_VIDEO_THUMBNAIL)):
+ if file_type in (IMAGE, XMIND) or \
+ (file_type == VIDEO and ENABLE_VIDEO_THUMBNAIL):
if os.path.exists(os.path.join(THUMBNAIL_ROOT, str(thumbnail_size), dirent.obj_id)):
req_image_path = posixpath.join(request_path, dirent.obj_name)
diff --git a/seahub/api2/endpoints/starred_items.py b/seahub/api2/endpoints/starred_items.py
index a38a59713e..495e74ed74 100644
--- a/seahub/api2/endpoints/starred_items.py
+++ b/seahub/api2/endpoints/starred_items.py
@@ -23,7 +23,7 @@ from seahub.thumbnail.utils import get_thumbnail_src
from seahub.base.models import UserStarredFiles
from seahub.base.templatetags.seahub_tags import email2nickname, \
email2contact_email
-from seahub.settings import ENABLE_THUMBNAIL, ENABLE_VIDEO_THUMBNAIL, \
+from seahub.settings import ENABLE_VIDEO_THUMBNAIL, \
THUMBNAIL_ROOT, THUMBNAIL_DEFAULT_SIZE
from seahub.utils.file_types import IMAGE, VIDEO, XMIND
@@ -58,7 +58,7 @@ class StarredItems(APIView):
dirent = seafile_api.get_dirent_by_path(repo_id, path)
item_info['mtime'] = timestamp_to_isoformat_timestr(dirent.mtime) if \
dirent else ''
- if ENABLE_THUMBNAIL and not starred_item.is_dir:
+ if not starred_item.is_dir:
file_type, file_ext = get_file_type_and_ext(item_info['obj_name'])
if file_type in (IMAGE, XMIND) or \
(file_type == VIDEO and ENABLE_VIDEO_THUMBNAIL):
diff --git a/seahub/api2/views.py b/seahub/api2/views.py
index 25f6dcd433..b1515f737a 100644
--- a/seahub/api2/views.py
+++ b/seahub/api2/views.py
@@ -99,7 +99,7 @@ if HAS_OFFICE_CONVERTER:
import seahub.settings as settings
from seahub.settings import THUMBNAIL_EXTENSION, THUMBNAIL_ROOT, \
FILE_LOCK_EXPIRATION_DAYS, ENABLE_STORAGE_CLASSES, \
- ENABLE_THUMBNAIL, STORAGE_CLASS_MAPPING_POLICY, \
+ STORAGE_CLASS_MAPPING_POLICY, \
ENABLE_RESET_ENCRYPTED_REPO_PASSWORD, SHARE_LINK_EXPIRE_DAYS_MAX, \
SHARE_LINK_EXPIRE_DAYS_MIN, SHARE_LINK_EXPIRE_DAYS_DEFAULT
@@ -5089,7 +5089,7 @@ class ThumbnailView(APIView):
if path is None or obj_id is None:
return api_error(status.HTTP_400_BAD_REQUEST, 'Wrong path.')
- if repo.encrypted or not ENABLE_THUMBNAIL or \
+ if repo.encrypted or \
check_folder_permission(request, repo_id, path) is None:
return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.')
diff --git a/seahub/base/context_processors.py b/seahub/base/context_processors.py
index 325c974cfd..90e010ee8f 100644
--- a/seahub/base/context_processors.py
+++ b/seahub/base/context_processors.py
@@ -20,7 +20,7 @@ import seaserv
from seahub.settings import SEAFILE_VERSION, SITE_TITLE, SITE_NAME, \
MAX_FILE_NAME, LOGO_PATH, BRANDING_CSS, LOGO_WIDTH, LOGO_HEIGHT,\
SHOW_REPO_DOWNLOAD_BUTTON, SITE_ROOT, ENABLE_GUEST_INVITATION, \
- FAVICON_PATH, ENABLE_THUMBNAIL, THUMBNAIL_SIZE_FOR_ORIGINAL, \
+ FAVICON_PATH, THUMBNAIL_SIZE_FOR_ORIGINAL, \
MEDIA_ROOT, SHOW_LOGOUT_ICON, CUSTOM_LOGO_PATH, CUSTOM_FAVICON_PATH, \
ENABLE_SEAFILE_DOCS, LOGIN_BG_IMAGE_PATH, \
CUSTOM_LOGIN_BG_PATH, ENABLE_SHARE_LINK_REPORT_ABUSE, \
@@ -136,7 +136,6 @@ def base(request):
'FILE_SERVER_ROOT': file_server_root,
'USE_GO_FILESERVER': seaserv.USE_GO_FILESERVER if hasattr(seaserv, 'USE_GO_FILESERVER') else False,
'LOGIN_URL': dj_settings.LOGIN_URL,
- 'enable_thumbnail': ENABLE_THUMBNAIL,
'thumbnail_size_for_original': THUMBNAIL_SIZE_FOR_ORIGINAL,
'enable_guest_invitation': ENABLE_GUEST_INVITATION,
'enable_terms_and_conditions': config.ENABLE_TERMS_AND_CONDITIONS,
diff --git a/seahub/repo_api_tokens/utils.py b/seahub/repo_api_tokens/utils.py
index 0fc1ba7f77..613b67f825 100644
--- a/seahub/repo_api_tokens/utils.py
+++ b/seahub/repo_api_tokens/utils.py
@@ -8,7 +8,7 @@ from seaserv import seafile_api
from seahub.base.models import UserStarredFiles
from seahub.base.templatetags.seahub_tags import email2nickname, email2contact_email
-from seahub.settings import ENABLE_THUMBNAIL, ENABLE_VIDEO_THUMBNAIL, THUMBNAIL_ROOT
+from seahub.settings import ENABLE_VIDEO_THUMBNAIL, THUMBNAIL_ROOT
from seahub.thumbnail.utils import get_thumbnail_src
from seahub.utils import is_pro_version, FILEEXT_TYPE_MAP, IMAGE, XMIND, VIDEO
from seahub.utils.file_tags import get_files_tags_in_dir
@@ -196,7 +196,7 @@ def get_dir_file_info_list(username, request_type, repo_obj, parent_dir,
file_info['file_tags'].append(file_tag)
# get thumbnail info
- if ENABLE_THUMBNAIL and with_thumbnail and not repo_obj.encrypted:
+ if with_thumbnail and not repo_obj.encrypted:
# used for providing a way to determine
# if send a request to create thumbnail.
diff --git a/seahub/settings.py b/seahub/settings.py
index 72b081ad9e..b12f8446e1 100644
--- a/seahub/settings.py
+++ b/seahub/settings.py
@@ -662,9 +662,6 @@ CAPTCHA_IMAGE_SIZE = (90, 42)
# Image Thumbnail #
###################
-# Enable or disable thumbnail
-ENABLE_THUMBNAIL = True
-
# Absolute filesystem path to the directory that will hold thumbnail files.
SEAHUB_DATA_ROOT = os.path.join(PROJECT_ROOT, '../../seahub-data')
if os.path.exists(SEAHUB_DATA_ROOT):
diff --git a/seahub/thumbnail/utils.py b/seahub/thumbnail/utils.py
index 5e81869401..80c32d8a9c 100644
--- a/seahub/thumbnail/utils.py
+++ b/seahub/thumbnail/utils.py
@@ -82,7 +82,6 @@ def generate_thumbnail(request, repo_id, size, path):
before generate thumbnail, you should check:
1. if repo exist: should exist;
2. if repo is encrypted: not encrypted;
- 3. if ENABLE_THUMBNAIL: enabled;
"""
try:
diff --git a/seahub/thumbnail/views.py b/seahub/thumbnail/views.py
index 39c368c67a..932a5f0669 100644
--- a/seahub/thumbnail/views.py
+++ b/seahub/thumbnail/views.py
@@ -16,7 +16,7 @@ from seaserv import get_repo, get_file_id_by_path
from seahub.auth.decorators import login_required_ajax, login_required
from seahub.views import check_folder_permission
from seahub.settings import THUMBNAIL_DEFAULT_SIZE, THUMBNAIL_EXTENSION, \
- THUMBNAIL_ROOT, ENABLE_THUMBNAIL
+ THUMBNAIL_ROOT
from seahub.thumbnail.utils import generate_thumbnail, \
get_thumbnail_src, get_share_link_thumbnail_src
from seahub.share.models import FileShare, check_share_link_common
@@ -46,7 +46,7 @@ def thumbnail_create(request, repo_id):
return HttpResponse(json.dumps({"error": err_msg}), status=400,
content_type=content_type)
- if repo.encrypted or not ENABLE_THUMBNAIL or \
+ if repo.encrypted or \
check_folder_permission(request, repo_id, path) is None:
err_msg = _("Permission denied.")
return HttpResponse(json.dumps({"error": err_msg}), status=403,
@@ -97,7 +97,7 @@ def thumbnail_get(request, repo_id, size, path):
return HttpResponse()
# check if is allowed
- if repo.encrypted or not ENABLE_THUMBNAIL or \
+ if repo.encrypted or \
check_folder_permission(request, repo_id, path) is None:
return HttpResponse()
@@ -162,7 +162,7 @@ def share_link_thumbnail_create(request, token):
return HttpResponse(json.dumps({"error": err_msg}), status=400,
content_type=content_type)
- if repo.encrypted or not ENABLE_THUMBNAIL:
+ if repo.encrypted:
err_msg = _("Permission denied.")
return HttpResponse(json.dumps({"error": err_msg}), status=403,
content_type=content_type)
@@ -245,7 +245,7 @@ def share_link_thumbnail_get(request, token, size, path):
return HttpResponse()
# check if is allowed
- if repo.encrypted or not ENABLE_THUMBNAIL:
+ if repo.encrypted:
return HttpResponse()
success = True
diff --git a/seahub/views/ajax.py b/seahub/views/ajax.py
index 6338846315..784dd01160 100644
--- a/seahub/views/ajax.py
+++ b/seahub/views/ajax.py
@@ -37,7 +37,7 @@ from seahub.views import get_unencry_rw_repos_by_user, \
from seahub.group.utils import is_group_member, is_group_admin_or_owner, \
get_group_member_info
import seahub.settings as settings
-from seahub.settings import ENABLE_THUMBNAIL, THUMBNAIL_ROOT, \
+from seahub.settings import THUMBNAIL_ROOT, \
THUMBNAIL_DEFAULT_SIZE, SHOW_TRAFFIC, MEDIA_URL, ENABLE_VIDEO_THUMBNAIL
from seahub.utils import check_filename_with_rename, EMPTY_SHA1, \
gen_block_get_url, \
@@ -247,7 +247,7 @@ def list_lib_dir(request, repo_id):
f_['obj_id'] = f.obj_id
f_['perm'] = f.permission # perm for file in current dir
- if not repo.encrypted and ENABLE_THUMBNAIL:
+ if not repo.encrypted:
# used for providing a way to determine
# if send a request to create thumbnail.
diff --git a/seahub/views/repo.py b/seahub/views/repo.py
index 6fa737bb5b..99176533f8 100644
--- a/seahub/views/repo.py
+++ b/seahub/views/repo.py
@@ -27,7 +27,7 @@ from seahub.utils import gen_dir_share_link, \
get_file_type_and_ext, get_service_url, normalize_dir_path
from seahub.utils.repo import is_repo_owner, get_repo_owner
from seahub.settings import ENABLE_UPLOAD_FOLDER, \
- ENABLE_RESUMABLE_FILEUPLOAD, ENABLE_THUMBNAIL, ENABLE_VIDEO_THUMBNAIL, \
+ ENABLE_RESUMABLE_FILEUPLOAD, ENABLE_VIDEO_THUMBNAIL, \
THUMBNAIL_ROOT, THUMBNAIL_DEFAULT_SIZE, THUMBNAIL_SIZE_FOR_GRID, \
MAX_NUMBER_OF_FILES_FOR_FILEUPLOAD, SHARE_LINK_EXPIRE_DAYS_MIN, \
SHARE_LINK_EXPIRE_DAYS_MAX, SEAFILE_COLLAB_SERVER, \
@@ -333,9 +333,8 @@ def view_shared_dir(request, fileshare):
if file_type == VIDEO:
f.is_video = True
- if ENABLE_THUMBNAIL and \
- (file_type in (IMAGE, XMIND) or \
- (file_type == VIDEO and ENABLE_VIDEO_THUMBNAIL)):
+ if file_type in (IMAGE, XMIND) or \
+ (file_type == VIDEO and ENABLE_VIDEO_THUMBNAIL):
if os.path.exists(os.path.join(THUMBNAIL_ROOT, str(thumbnail_size), f.obj_id)):
req_image_path = posixpath.join(req_path, f.obj_name)
src = get_share_link_thumbnail_src(token, thumbnail_size, req_image_path)
@@ -362,7 +361,6 @@ def view_shared_dir(request, fileshare):
'traffic_over_limit': traffic_over_limit,
'no_quota': no_quota,
'permissions': permissions,
- 'ENABLE_THUMBNAIL': ENABLE_THUMBNAIL,
'mode': mode,
'thumbnail_size': thumbnail_size,
'dir_share_link': dir_share_link,