RAW images, specifically DNG, aren’t loading previews, just downloading
Describe the bug Since Viewer updated to 4.0.0, .dng images aren’t able to be loaded as previews, just downloaded. They also don’t appear in the Photos app.
To Reproduce Steps to reproduce the behavior:
- Install camerarawpreviews, ensure .dng previews are generated and visible (they are in this case)
- Click on Files app
-
- Click on the desired subfolder
- Click on the desired .dng image
- .dng pops up as a download, rather than loading a preview like with .jpg, etc
Expected behavior RAW images used to load previews as a pop up image like .jpg. This no longer occurs
Screenshots N/A, logs:
.jpg:
{"reqId":"4yBKAL1JlOuZbyjxtDUC","level":0,"time":"2025-09-02T19:42:33+00:00","remoteAddr":"X.X.X.X","user":"YYY","app":"no app in context","method":"GET","url":"/core/preview?fileId=40123887&x=2420&y=1454&a=true&etag=8daef698d10187e994b084d2ae70a2df","message":"Requesting preview for /YYY/files/Photos/2025/08/08,03,2025,10;14;10;AM,1345 1.jpg with width=2420, height=1454, crop=false, mode=fill, mimeType=null","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15","version":"31.0.8.1","data":[]}
.dng:
{"reqId":"ChenTyWO6jhbeE9FiruS","level":0,"time":"2025-09-02T19:42:37+00:00","remoteAddr":"X.X.X.X","user":"YYY","app":"workflowengine","method":"GET","url":"/remote.php/dav/files/YYY/Photos/2025/08/08%2C03%2C2025%2C15%3B40%3B06%3BPM%2C1347.dng","message":"No flow configurations is going to run Block access to a file","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15","version":"31.0.8.1","data":{"app":"workflowengine","level":"0"}}
.heic (since these are disabled by default, just to confirm my config works):
{"reqId":"VRyPMygzLp13z4aBsfaK","level":0,"time":"2025-09-02T19:57:09+00:00","remoteAddr":"X.X.X.X","user":"YYY","app":"no app in context","method":"GET","url":"/core/preview?fileId=40126394&x=2420&y=1454&a=true&etag=7241996c8e28194e9cf1eff7990aaae2","message":"Requesting preview for /YYY/files/Photos/2025/08/08,16,2025,14;08;29;PM,1213.heic with width=2420, height=1454, crop=false, mode=fill, mimeType=null","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15","version":"31.0.8.1","data":[]}
Config.php:
'enable_previews' => true,
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\Movie',
1 => 'OC\\Preview\\PNG',
2 => 'OC\\Preview\\JPEG',
3 => 'OC\\Preview\\GIF',
4 => 'OC\\Preview\\BMP',
5 => 'OC\\Preview\\XBitmap',
6 => 'OC\\Preview\\MP3',
7 => 'OC\\Preview\\MP4',
8 => 'OC\\Preview\\TXT',
9 => 'OC\\Preview\\MarkDown',
10 => 'OC\\Preview\\PDF',
11 => 'OC\\Preview\\HEIC',
12 => 'OC\\Preview\\HEIF',
13 => 'OC\\Preview\\DNG',
14 => 'OC\\Preview\\MOV',
15 => 'OC\\Preview\\Image',
),
Desktop (please complete the following information):
- OS: iOS, Mac OS and Windows 10
- Browser Safari, Firefox and Edge
- Version Safari 18.6, Firefox, 142.01 Edge 139.03405.125
Smartphone (please complete the following information):
- Device: iPhone 14 Pro Max, iPad Pro M4
- OS: iOS 18.6.2
- Browser Safari
- Version
Firefox
No Log entry, just downloads
Additional context I worked through this with ariselseng to eliminate camerarawpreveiws as the issue here: https://github.com/ariselseng/camerarawpreviews/issues/115
I was able to finally get the dng’s to pop up like jpeg’s instead of download by adding “image/x-dcraw”, “image/x-adobe-dng”, “image/dng”, to the viewer-init.js and viewer-init.js.map. Not sure if that’s viable, but it works. Still not loading in photos, I’ll probably cross post that in the photos app. Hopefully this helps point into the right direction, though.
Some more feedback. From Firefox console error logs:
Object { app: "viewer", uid: "NCfeedback", level: 0, error: "The handler doesn't have a valid component", handler: {…} }
app: "viewer"
error: "The handler doesn't have a valid component"
handler: Object { id: "camerarawpreviews", mimesAliases: {…} }
id: "camerarawpreviews"
mimesAliases: Object { "image/x-dcraw": "image/jpeg" }
"image/x-dcraw": "image/jpeg"
<prototype>: Object { … }
__defineGetter__: function __defineGetter__()
__defineSetter__: function __defineSetter__() ```
This is because the API of viewer has changed, you have to pass more now, I am currently writing an app based on this app for AVIF, and am in the process of fixing the problem. https://github.com/nextcloud/viewer/blob/master/src/models/images.js https://github.com/nextcloud/viewer/blob/master/src/components/Images.vue It has to be done this way now, even though it's outdated https://github.com/ONLYOFFICE/onlyoffice-nextcloud/blob/master/src/viewer.js , this is the new method. https://www.npmjs.com/package/@nextcloud/viewer
(function (OCA) {
if (!OCA.Viewer) {
console.warn('Viewer not available')
return
}
const RAWViewer = {
name: 'RAWViewer',
props: {
filename: { type: String, default: null },
fileid: { type: Number, default: null },
previewPath: { type: String, default: null },
},
render(createElement) {
if (!this.previewPath) {
return createElement('div', 'Kein Preview verfügbar')
}
const url = OC.generateUrl(this.previewPath)
return createElement('img', {
attrs: {
src: url,
alt: this.filename || 'RAW preview',
style: 'max-width: 100%; max-height: 100%; object-fit: contain;',
},
on: {
load: () => {
this.doneLoading()
}
}
})
},
}
OCA.Viewer.registerHandler({
id: 'camerarawpreviews',
group: 'media',
mimes: [
'image/x-dcraw',
],
//mimesAliases: { 'image/x-dcraw': 'image/jpeg' }, // Fallback
component: RAWViewer,
})
console.log('RAWViewer registered!')
})(OCA)