Skip to content

Commit

Permalink
Encode dav path segments for direct preview
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed May 27, 2021
1 parent 1720c4a commit f1fb076
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
30 changes: 22 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@nextcloud/initial-state": "^1.2.0",
"@nextcloud/l10n": "^1.4.1",
"@nextcloud/moment": "^1.1.1",
"@nextcloud/paths": "^2.0.0",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "^3.5.4",
"@nextcloud/vue-dashboard": "^1.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import ProgressBar from '@nextcloud/vue/dist/Components/ProgressBar'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
import Close from 'vue-material-design-icons/Close'
import { getCapabilities } from '@nextcloud/capabilities'
import { encodePath } from '@nextcloud/paths'
const PREVIEW_TYPE = {
TEMPORARY: 0,
Expand Down Expand Up @@ -248,10 +249,10 @@ export default {
// return direct image
if (userId === null) {
// guest mode, use public link download URL
return this.link + '/download/' + this.name
return this.link + '/download/' + encodePath(this.name)
} else {
// use direct DAV URL
return generateRemoteUrl(`dav/files/${userId}`) + this.internalAbsolutePath
return generateRemoteUrl(`dav/files/${userId}`) + encodePath(this.internalAbsolutePath)
}
}
Expand Down

0 comments on commit f1fb076

Please sign in to comment.