Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ export default {
* File size in bytes
*/
size: {
type: Number,
default: -1,
type: String,
default: '-1',
},
/**
* Download link
Expand All @@ -177,8 +177,8 @@ export default {
* File ETag
*/
permissions: {
type: Number,
default: 0,
type: String,
default: '0',
},
/**
* Whether a preview is available, string "yes" for yes
Expand All @@ -194,15 +194,15 @@ export default {
* If preview and metadata are available, return width
*/
width: {
type: Number,
type: String,
default: null,
},

/**
* If preview and metadata are available, return height
*/
height: {
type: Number,
type: String,
default: null,
},

Expand Down Expand Up @@ -402,12 +402,12 @@ export default {
}

const sizeMultiplicator = Math.min(
(heightConstraint > this.height ? 1 : (heightConstraint / this.height)),
(widthConstraint > this.width ? 1 : (widthConstraint / this.width))
(heightConstraint > parseInt(this.height, 10) ? 1 : (heightConstraint / parseInt(this.height, 10))),
(widthConstraint > parseInt(this.width, 10) ? 1 : (widthConstraint / parseInt(this.width, 10)))
)

return {
width: this.width * sizeMultiplicator + 'px',
width: parseInt(this.width, 10) * sizeMultiplicator + 'px',
aspectRatio: this.width + '/' + this.height,
}
},
Expand All @@ -421,7 +421,7 @@ export default {
return PREVIEW_TYPE.MIME_ICON
}
const maxGifSize = getCapabilities()?.spreed?.config?.previews?.['max-gif-size'] || 3145728
if (this.mimetype === 'image/gif' && this.size <= maxGifSize) {
if (this.mimetype === 'image/gif' && parseInt(this.size, 10) <= maxGifSize) {
return PREVIEW_TYPE.DIRECT
}

Expand Down