-
Notifications
You must be signed in to change notification settings - Fork 60
Fix regression: Use Photos preview API for that webdav collection #1431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes a regression where the viewer cannot show any photos from collaborative albums, since these previews are not accessible over the core API. Signed-off-by: Varun Patil <[email protected]>
4de35ea to
22fc708
Compare
| if (isPublic()) { | ||
| return generateUrl(`/apps/files_sharing/publicpreview/${getToken()}?file=${encodeFilePath(filename)}&${searchParams}`) | ||
| } | ||
| if (filename.startsWith('/photos/')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filename is the full dav path btw, including the collection. So for a normal file it looks like /files/user/... and /photos/user/... for collaborative albums.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
@pulsejet don't ping random devs please :) |
|
Apologies. He authored the commit that got broken (a05dbf3) so I thought he might know better. |
|
Would it make sense to address this problem in a way that callers can decide how to provide preview urls for special cases instead of hard-coding the logic? E.g.: OCA.Viewer.open({
...
previewUrl: ({ fileid, public, width, height }) => {
return !public && generateUrl(`/apps/photos/api/v1/preview/${fileid}?x=${width}&y=${height}`)
},
...
})getPreviewIfAny({ fileid, filename, hasPreview, davPath }) {
const width = Math.floor(screen.width * devicePixelRatio)
const height = Math.floor(screen.height * devicePixelRatio)
const searchParams = `fileId=${fileid}`
+ `&x=${width}`
+ `&y=${height}`
+ '&a=true'
if (hasPreview) {
const args = { fileid, filename, width, height, public: isPublic(), token: getToken() }
const url = typeof this.previewUrl == 'function' && this.previewUrl(args)
if (typeof url == 'string') {
return url
}
// TODO: find a nicer standard way of doing this?
if (isPublic()) {
return generateUrl(`/apps/files_sharing/publicpreview/${getToken()}?file=${encodeFilePath(filename)}&${searchParams}`)
}
... |
|
Just an update here. I'm still not ok with adding custom app-oriented conditions in Viewer. |
Do you mean nextcloud/photos#1440 is fixed? That's what this PR was meant to address.
Yeah it's not ideal at all. I just submitted this patch as a quick fix. |
@skjnldsv @artonge I just want to point out that things are broken (this is latest stable25). Everyone doesn't use JPEG :) Also closely related, with a lot of upvotes: nextcloud/photos#1452 |
|
Closing for #1525 |


Fixes a regression where the viewer cannot show any photos from collaborative albums, since these previews are not accessible over the core API.
I unfortunately introduced this while fixing another regression in #1409 😩
Any better ideas to do this? Using the source image directly isn't right because it might be huge (plus no support for HEIC/TIFF), so this seems like the better option.