1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 17:02:47 +00:00
This commit is contained in:
Ranjiwei
2024-11-15 20:38:27 +08:00
committed by GitHub
parent edaf88f6cc
commit d4fc55b76d
3 changed files with 9 additions and 10 deletions

View File

@@ -211,13 +211,9 @@ class MarkdownEditor extends React.Component {
const fileInfoRes = await seafileAPI.getFileInfo(repoID, filePath);
const { mtime, size, starred, permission, last_modifier_name, id } = fileInfoRes.data;
const lastModifier = last_modifier_name;
// get file download url
const fileDownloadUrlRes = await seafileAPI.getFileDownloadLink(repoID, filePath);
const downloadUrl = fileDownloadUrlRes.data;
const { rawPath } = window.app.pageOptions;
// get file content
const fileContentRes = await seafileAPI.getFileContent(downloadUrl);
const fileContentRes = await seafileAPI.getFileContent(rawPath);
const markdownContent = fileContentRes.data;
// init permission

View File

@@ -40,6 +40,7 @@
repoName: '{{ repo.name|escapejs }}',
filePath: '{{ path|escapejs }}',
fileName: '{{ filename|escapejs }}',
rawPath: '{{ raw_path|escapejs }}',
domain: '{{ domain }}',
protocol: '{{ protocol }}',
lang: '{{ language_code }}',

View File

@@ -643,9 +643,10 @@ def view_lib_file(request, repo_id, path):
# template = 'view_file_%s.html' % filetype.lower()
template = '%s_file_view_react.html' % filetype.lower()
if filetype in [VIDEO, PDF, MARKDOWN]:
raw_path = gen_file_get_url_new(repo_id, path)
if filetype in (IMAGE, VIDEO, AUDIO, PDF, SVG, XMIND, 'Unknown'):
if filetype == VIDEO:
raw_path = gen_file_get_url_new(repo_id, path)
template = 'common_file_view_react.html'
if filetype == SEADOC:
@@ -746,6 +747,7 @@ def view_lib_file(request, repo_id, path):
return_dict['share_link_expire_days_Default'] = SHARE_LINK_EXPIRE_DAYS_DEFAULT
return_dict['share_link_expire_days_min'] = SHARE_LINK_EXPIRE_DAYS_MIN
return_dict['share_link_expire_days_max'] = SHARE_LINK_EXPIRE_DAYS_MAX
return_dict['raw_path'] = raw_path
can_edit_file = True
if parse_repo_perm(permission).can_edit_on_web is False:
@@ -1231,8 +1233,8 @@ def view_shared_file(request, fileshare):
ret_dict = {'err': '', 'file_content': '', 'encoding': '', 'file_enc': '',
'file_encoding_list': [], 'filetype': filetype}
if filetype == VIDEO:
raw_path = gen_file_get_url_new(repo_id, path)
if filetype in [VIDEO, PDF, MARKDOWN]:
raw_path = gen_file_get_url_by_sharelink(fileshare.token)
if filetype == SEADOC:
file_uuid = get_seadoc_file_uuid(repo, path)