Skip to content

Commit 8bb41fb

Browse files
authored
Merge pull request #52819 from nextcloud/backport/52809/stable31
[stable31] fix(files): do not even try to fetch a preview if `has-preview` is false
2 parents ca9193a + 52ffa36 commit 8bb41fb

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

apps/files/src/components/FileEntry/FileEntryPreview.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
class="files-list__row-icon-blurhash"
2222
aria-hidden="true" />
2323
<img v-if="backgroundFailed !== true"
24+
:key="source.fileid"
2425
ref="previewImg"
2526
alt=""
2627
class="files-list__row-icon-preview"
@@ -147,6 +148,17 @@ export default defineComponent({
147148
return null
148149
}
149150
151+
if (this.source.attributes['has-preview'] !== true
152+
&& this.source.mime !== undefined
153+
&& this.source.mime !== 'application/octet-stream'
154+
) {
155+
const previewUrl = generateUrl('/core/mimeicon?mime={mime}', {
156+
mime: this.source.mime,
157+
})
158+
const url = new URL(window.location.origin + previewUrl)
159+
return url.href
160+
}
161+
150162
try {
151163
const previewUrl = this.source.attributes.previewUrl
152164
|| (this.isPublic

dist/files-main.js

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

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)