aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-05-21 11:51:34 +0200
committernextcloud-command <nextcloud-command@users.noreply.github.com>2024-05-23 11:56:27 +0000
commit3ca3c65b0d569a96eabb2aeb80de36be72bed032 (patch)
treee31fba5388ebbd74b5c4ba696a9e118066a164b4 /apps
parent474cbda59a4c5c4a225918724a871451a0f49a7f (diff)
downloadnextcloud-server-3ca3c65b0d569a96eabb2aeb80de36be72bed032.tar.gz
nextcloud-server-3ca3c65b0d569a96eabb2aeb80de36be72bed032.zip
feat(files): refresh preview on etag change
Signed-off-by: skjnldsv <skjnldsv@protonmail.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/src/components/FileEntry/FileEntryPreview.vue7
-rw-r--r--apps/files/src/views/Sidebar.vue3
2 files changed, 8 insertions, 2 deletions
diff --git a/apps/files/src/components/FileEntry/FileEntryPreview.vue b/apps/files/src/components/FileEntry/FileEntryPreview.vue
index d1bb78a105e..cec39914fcd 100644
--- a/apps/files/src/components/FileEntry/FileEntryPreview.vue
+++ b/apps/files/src/components/FileEntry/FileEntryPreview.vue
@@ -76,10 +76,11 @@ import NetworkIcon from 'vue-material-design-icons/Network.vue'
import TagIcon from 'vue-material-design-icons/Tag.vue'
import PlayCircleIcon from 'vue-material-design-icons/PlayCircle.vue'
-import { useUserConfigStore } from '../../store/userconfig.ts'
import CollectivesIcon from './CollectivesIcon.vue'
import FavoriteIcon from './FavoriteIcon.vue'
+
import { isLivePhoto } from '../../services/LivePhotos'
+import { useUserConfigStore } from '../../store/userconfig.ts'
export default Vue.extend({
name: 'FileEntryPreview',
@@ -162,6 +163,10 @@ export default Vue.extend({
url.searchParams.set('y', this.gridMode ? '128' : '32')
url.searchParams.set('mimeFallback', 'true')
+ // Etag to force refresh preview on change
+ const etag = this.source?.attributes?.etag || ''
+ url.searchParams.set('v', etag.slice(0, 6))
+
// Handle cropping
url.searchParams.set('a', this.cropPreviews === true ? '0' : '1')
return url.href
diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue
index 398144e2414..9a9f9be7be8 100644
--- a/apps/files/src/views/Sidebar.vue
+++ b/apps/files/src/views/Sidebar.vue
@@ -335,7 +335,8 @@ export default {
getPreviewIfAny(fileInfo) {
if (fileInfo?.hasPreview && !this.isFullScreen) {
- return generateUrl(`/core/preview?fileId=${fileInfo.id}&x=${screen.width}&y=${screen.height}&a=true`)
+ const etag = fileInfo?.etag || ''
+ return generateUrl(`/core/preview?fileId=${fileInfo.id}&x=${screen.width}&y=${screen.height}&a=true&v=${etag.slice(0, 6)}`)
}
return this.getIconUrl(fileInfo)
},