fix(Utils): use the more robust QClipboardProxy checks
- when verifying whether an image has a suitable size or extension
This commit is contained in:
parent
b5a7df685a
commit
b83b8e7466
|
@ -3,6 +3,8 @@ pragma Singleton
|
|||
import QtQuick 2.13
|
||||
|
||||
import shared 1.0
|
||||
|
||||
import StatusQ 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
||||
|
||||
|
@ -335,16 +337,15 @@ QtObject {
|
|||
}
|
||||
|
||||
function isValidDragNDropImage(url) {
|
||||
let lowerCaseUrl = url.toLowerCase()
|
||||
return Constants.acceptedDragNDropImageExtensions.some(ext => lowerCaseUrl.endsWith(ext)) ||
|
||||
lowerCaseUrl.startsWith(Constants.dataImagePrefix);
|
||||
return url.startsWith(Constants.dataImagePrefix) ||
|
||||
QClipboardProxy.isValidImageUrl(url, Constants.acceptedDragNDropImageExtensions)
|
||||
}
|
||||
|
||||
function isFilesizeValid(img) {
|
||||
if (img.startsWith(Constants.dataImagePrefix)) {
|
||||
return img.length < maxImgSizeBytes
|
||||
}
|
||||
let size = parseInt(globalUtils.getFileSize(img))
|
||||
const size = QClipboardProxy.getFileSize(img)
|
||||
return size <= maxImgSizeBytes
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue