Skip to content

Commit

Permalink
Use preview for unsupported images (fix #1408)
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <varunpatil@ucla.edu>
  • Loading branch information
pulsejet authored and skjnldsv committed Oct 12, 2022
1 parent ba57ec6 commit d89a882
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 8 deletions.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/image-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/image2-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/non-dav-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/video-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default {
return this.getBase64FromImage()
}
if (this.source) {
if (this.source && !this.hasPreview) {
return this.source
}
Expand Down
8 changes: 1 addition & 7 deletions src/mixins/PreviewUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default {
previewPath() {
return this.getPreviewIfAny({
fileid: this.fileid,
source: this.source,
filename: this.filename,
hasPreview: this.hasPreview,
davPath: this.davPath,
Expand All @@ -60,17 +59,12 @@ export default {
*
* @param {object} data destructuring object
* @param {string} data.fileid the file id
* @param {?string} data.source the download source
* @param {boolean} data.hasPreview have the file an existing preview ?
* @param {string} data.davPath the absolute dav path
* @param {string} data.filename the file name
* @return {string} the absolute url
*/
getPreviewIfAny({ fileid, source, filename, hasPreview, davPath }) {
if (source) {
return source
}

getPreviewIfAny({ fileid, filename, hasPreview, davPath }) {
const searchParams = `fileId=${fileid}`
+ `&x=${Math.floor(screen.width * devicePixelRatio)}`
+ `&y=${Math.floor(screen.height * devicePixelRatio)}`
Expand Down

0 comments on commit d89a882

Please sign in to comment.