From b83b8e746631ce135e51e95f2465556c22fefeae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Wed, 7 Jun 2023 17:51:15 +0200 Subject: [PATCH] fix(Utils): use the more robust QClipboardProxy checks - when verifying whether an image has a suitable size or extension --- ui/imports/utils/Utils.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/imports/utils/Utils.qml b/ui/imports/utils/Utils.qml index 608184eea3..c54512a5fa 100644 --- a/ui/imports/utils/Utils.qml +++ b/ui/imports/utils/Utils.qml @@ -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 }