Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 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 @@ -27,6 +27,7 @@
"@nextcloud/initial-state": "^1.2.0",
"@nextcloud/l10n": "^1.4.1",
"@nextcloud/moment": "^1.1.1",
"@nextcloud/paths": "^2.0.0",
"@nextcloud/router": "^2.0.0",
"@nextcloud/vue": "^3.9.0",
"@nextcloud/vue-dashboard": "^1.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ describe('FilePreview.vue', () => {
describe('gif rendering', () => {
beforeEach(() => {
propsData.mimetype = 'image/gif'
propsData.name = 'test.gif'
propsData.path = 'path/to/test.gif'
propsData.name = 'test %20.gif'
propsData.path = 'path/to/test %20.gif'

loadState.mockImplementation((app, key) => {
if (app === 'core' && key === 'capabilities') {
Expand Down Expand Up @@ -252,12 +252,12 @@ describe('FilePreview.vue', () => {

expect(wrapper.element.tagName).toBe('A')
expect(wrapper.find('img').attributes('src'))
.toBe(generateRemoteUrl('dav/files/current-user-id/path/to/test.gif'))
.toBe(generateRemoteUrl('dav/files/current-user-id') + '/path/to/test%20%2520.gif')
})

test('directly renders small GIF files (absolute path)', async() => {
propsData.size = 128
propsData.path = '/path/to/test.gif'
propsData.path = '/path/to/test %20.gif'

const wrapper = shallowMount(FilePreview, {
localVue,
Expand All @@ -269,7 +269,7 @@ describe('FilePreview.vue', () => {

expect(wrapper.element.tagName).toBe('A')
expect(wrapper.find('img').attributes('src'))
.toBe(generateRemoteUrl('dav/files/current-user-id/path/to/test.gif'))
.toBe(generateRemoteUrl('dav/files/current-user-id') + '/path/to/test%20%2520.gif')
})

test('directly renders small GIF files for guests', async() => {
Expand All @@ -287,7 +287,7 @@ describe('FilePreview.vue', () => {

expect(wrapper.element.tagName).toBe('A')
expect(wrapper.find('img').attributes('src'))
.toBe(propsData.link + '/download/test.gif')
.toBe(propsData.link + '/download/test%20%2520.gif')
})

test('renders static preview for big GIF files', async() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
import Close from 'vue-material-design-icons/Close'
import PlayCircleOutline from 'vue-material-design-icons/PlayCircleOutline'
import { getCapabilities } from '@nextcloud/capabilities'
import { encodePath } from '@nextcloud/paths'

const PREVIEW_TYPE = {
TEMPORARY: 0,
Expand Down Expand Up @@ -289,10 +290,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