1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-26 07:22:34 +00:00

fix restore sdoc bug (#7957)

* fix restore sdoc bug

* optimize code

---------

Co-authored-by: 小强 <shuntian@Mac.lan>
This commit is contained in:
杨顺强
2025-06-20 11:36:56 +08:00
committed by GitHub
parent 47d9e62053
commit cb21fa8095
4 changed files with 27 additions and 10 deletions

View File

@@ -19,7 +19,7 @@
"@seafile/resumablejs": "1.1.16", "@seafile/resumablejs": "1.1.16",
"@seafile/seafile-calendar": "0.0.28", "@seafile/seafile-calendar": "0.0.28",
"@seafile/seafile-editor": "2.0.11", "@seafile/seafile-editor": "2.0.11",
"@seafile/seafile-sdoc-editor": "2.0.9", "@seafile/seafile-sdoc-editor": "2.0.11",
"@seafile/stldraw-editor": "1.0.1", "@seafile/stldraw-editor": "1.0.1",
"@uiw/codemirror-extensions-langs": "^4.19.4", "@uiw/codemirror-extensions-langs": "^4.19.4",
"@uiw/codemirror-themes": "^4.23.5", "@uiw/codemirror-themes": "^4.23.5",
@@ -5560,9 +5560,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@seafile/sdoc-editor": { "node_modules/@seafile/sdoc-editor": {
"version": "2.0.92", "version": "2.0.94",
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-2.0.92.tgz", "resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-2.0.94.tgz",
"integrity": "sha512-2o+r4f3hKFKiet57dAhKbdnm0W/MS0BVqXTNFUr0YXSnsx1HMa4+F92IXNmlTozsze1RNbH8GhjCZ3ncGmroeg==", "integrity": "sha512-YGqUJOKfsBWmAA4ngpmWsvJcOwo0igzgokmXLAe3W37C2yrwG8LE2zKlBv0/ZybKdPRx61wfbRGyurQLzzDuQw==",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@seafile/print-js": "1.6.6", "@seafile/print-js": "1.6.6",
@@ -5788,13 +5788,13 @@
} }
}, },
"node_modules/@seafile/seafile-sdoc-editor": { "node_modules/@seafile/seafile-sdoc-editor": {
"version": "2.0.9", "version": "2.0.11",
"resolved": "https://registry.npmjs.org/@seafile/seafile-sdoc-editor/-/seafile-sdoc-editor-2.0.9.tgz", "resolved": "https://registry.npmjs.org/@seafile/seafile-sdoc-editor/-/seafile-sdoc-editor-2.0.11.tgz",
"integrity": "sha512-liD+o2qH9sx3yL0Ax0p3YBwTTNSY+zGyBlqzKPhK8dCkpPcLY9KuxmmRjOslM/63ckyRVXxw6+bQu5ENv4qzZw==", "integrity": "sha512-42ltaif+zzd5vHMGfU/7K+ujQLu1QcVxxR2ZRqDhQ9qQ1OyX0fvpaMRWQXZoxUqWH1IquhrBqpEiJ0/fiUDPWA==",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@seafile/print-js": "1.6.6", "@seafile/print-js": "1.6.6",
"@seafile/sdoc-editor": "^2.0.92", "@seafile/sdoc-editor": "^2.0.94",
"classnames": "2.3.2", "classnames": "2.3.2",
"dayjs": "1.10.7" "dayjs": "1.10.7"
}, },

View File

@@ -14,7 +14,7 @@
"@seafile/resumablejs": "1.1.16", "@seafile/resumablejs": "1.1.16",
"@seafile/seafile-calendar": "0.0.28", "@seafile/seafile-calendar": "0.0.28",
"@seafile/seafile-editor": "2.0.11", "@seafile/seafile-editor": "2.0.11",
"@seafile/seafile-sdoc-editor": "2.0.9", "@seafile/seafile-sdoc-editor": "2.0.11",
"@seafile/stldraw-editor": "1.0.1", "@seafile/stldraw-editor": "1.0.1",
"@uiw/codemirror-extensions-langs": "^4.19.4", "@uiw/codemirror-extensions-langs": "^4.19.4",
"@uiw/codemirror-themes": "^4.23.5", "@uiw/codemirror-themes": "^4.23.5",
@@ -24,9 +24,9 @@
"codemirror": "^6.0.1", "codemirror": "^6.0.1",
"copy-to-clipboard": "^3.0.8", "copy-to-clipboard": "^3.0.8",
"crypto-js": "4.2.0", "crypto-js": "4.2.0",
"d3": "~7.9.0",
"dayjs": "1.10.7", "dayjs": "1.10.7",
"deep-copy": "1.4.2", "deep-copy": "1.4.2",
"d3": "~7.9.0",
"emoji-mart": "^5.6.0", "emoji-mart": "^5.6.0",
"i18next": "^25.2.1", "i18next": "^25.2.1",
"i18next-browser-languagedetector": "^8.1.0", "i18next-browser-languagedetector": "^8.1.0",

View File

@@ -1,3 +1,7 @@
.sdoc-file-view .sdoc-editor-container { .sdoc-file-view .sdoc-editor-container {
background: transparent; background: transparent;
} }
.file-view-content .sdoc-editor-container .sdoc-editor-content .sdoc-article-container {
margin: auto !important;
}

View File

@@ -38,6 +38,7 @@ from seahub.settings import MAX_UPLOAD_FILE_NAME_LEN, OFFICE_TEMPLATE_ROOT
from seahub.api2.endpoints.utils import convert_file, sdoc_convert_to_docx from seahub.api2.endpoints.utils import convert_file, sdoc_convert_to_docx
from seahub.seadoc.utils import get_seadoc_file_uuid from seahub.seadoc.utils import get_seadoc_file_uuid
from seahub.exdraw.utils import get_exdraw_file_uuid from seahub.exdraw.utils import get_exdraw_file_uuid
from seahub.seadoc.sdoc_server_api import SdocServerAPI
from seaserv import seafile_api from seaserv import seafile_api
from pysearpc import SearpcError from pysearpc import SearpcError
@@ -529,6 +530,18 @@ class FileView(APIView):
error_msg = 'Internal Server Error' error_msg = 'Internal Server Error'
return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg)
extension = Path(path).suffix
if extension == '.sdoc':
try:
doc_uuid = get_seadoc_file_uuid(repo, path)
filename = os.path.basename(path)
sdoc_server_api = SdocServerAPI(doc_uuid, str(filename), username)
sdoc_server_api.replace_doc()
except Exception as e:
logger.error(e)
error_msg = 'Internal Server Error'
return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg)
return Response({'success': True}) return Response({'success': True})
if operation == 'convert': if operation == 'convert':