Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax <max@nextcloud.com>2022-02-22 06:15:39 +0300
committerMax <max@nextcloud.com>2022-03-02 10:19:16 +0300
commitd3315bf32a8c966b3a7aea45c3df762277e1e2a0 (patch)
tree2a6e3b9a8c0aba35a0c90f160fdeb02733704fbf /src
parent7782f4ddfb05bbbb78f25778999c8b74290b4874 (diff)
fix: workspace with alternative file names
Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'src')
-rw-r--r--src/helpers/files.js42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/helpers/files.js b/src/helpers/files.js
index 4551b5cea..2a2de1d0d 100644
--- a/src/helpers/files.js
+++ b/src/helpers/files.js
@@ -151,20 +151,42 @@ const FilesWorkspacePlugin = {
priority: 10,
})
- fileList.filesClient.addFileInfoParser((_response, data) => {
- const dir = (data.mimetype === 'httpd/unix-directory')
- ? data.path + (data.path.endsWith('/') ? '' : '/') + data.name
- : data.path
- if (dir !== fileList.getCurrentDirectory()) {
- return
- }
+ const PROPERTY_WORKSPACE_FILE = `{${OC.Files.Client.NS_NEXTCLOUD}}rich-workspace-file`
+
+ const oldGetWebdavProperties = fileList._getWebdavProperties
+ fileList._getWebdavProperties = function() {
+ return [
+ ...oldGetWebdavProperties.apply(this, arguments),
+ PROPERTY_WORKSPACE_FILE,
+ ]
+ }
+
+ let filename = null
+
+ fileList.filesClient.addFileInfoParser((response, data) => {
if (data.mimetype === 'httpd/unix-directory') {
- this.vm.folder = { ...data }
+ const props = response.propStat[0].properties
+ filename = props[PROPERTY_WORKSPACE_FILE]
+ const dir = (data.mimetype === 'httpd/unix-directory')
+ ? data.path + (data.path.endsWith('/') ? '' : '/') + data.name
+ : data.path
+ if (dir === fileList.getCurrentDirectory()) {
+ this.vm.folder = {
+ ...data,
+ }
+ }
}
- if (data.mimetype === 'text/markdown' && data.name === 'Readme.md') {
- this.vm.file = { ...data }
+ if (data.mimetype === 'text/markdown') {
+ const name = filename || 'Readme.md'
+ if (data.name === name) {
+ this.vm.file = {
+ ...data,
+ id: parseInt(data.id),
+ }
+ }
}
})
+
},
render(fileList) {