Skip to content

Commit 2b316d8

Browse files
Merge pull request #5674 from nextcloud/bugfix/5672/fix-dav-path-encoding/stable21.1
[stable21.1] Encode dav path segments for direct preview
2 parents f7f279e + f1fb076 commit 2b316d8

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

package-lock.json

Lines changed: 22 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@nextcloud/initial-state": "^1.2.0",
2727
"@nextcloud/l10n": "^1.4.1",
2828
"@nextcloud/moment": "^1.1.1",
29+
"@nextcloud/paths": "^2.0.0",
2930
"@nextcloud/router": "^1.2.0",
3031
"@nextcloud/vue": "^3.5.4",
3132
"@nextcloud/vue-dashboard": "^1.0.1",

src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import ProgressBar from '@nextcloud/vue/dist/Components/ProgressBar'
7070
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
7171
import Close from 'vue-material-design-icons/Close'
7272
import { getCapabilities } from '@nextcloud/capabilities'
73+
import { encodePath } from '@nextcloud/paths'
7374
7475
const PREVIEW_TYPE = {
7576
TEMPORARY: 0,
@@ -248,10 +249,10 @@ export default {
248249
// return direct image
249250
if (userId === null) {
250251
// guest mode, use public link download URL
251-
return this.link + '/download/' + this.name
252+
return this.link + '/download/' + encodePath(this.name)
252253
} else {
253254
// use direct DAV URL
254-
return generateRemoteUrl(`dav/files/${userId}`) + this.internalAbsolutePath
255+
return generateRemoteUrl(`dav/files/${userId}`) + encodePath(this.internalAbsolutePath)
255256
}
256257
}
257258

0 commit comments

Comments
 (0)