From 45a0298d25cb8e4055d6da1c9ea625a4cab74352 Mon Sep 17 00:00:00 2001 From: wangzhiyu Date: Wed, 5 Jul 2023 14:51:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E6=8F=92?= =?UTF-8?q?=E5=85=A5=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangzhiyu --- .../main/ets/default/baseUtil/OperationUtils.ets | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets b/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets index cf462b6..58b3a22 100644 --- a/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets +++ b/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets @@ -23,9 +23,8 @@ export class OperationUtils { async copy(uri: string):Promise { try { - let numId = this.getIdByUri(uri) var context = globalThis.noteContext - let fileAsset = await this.getFileAssetById(numId,context); + let fileAsset = await this.getFileAssetById(uri, context); if (fileAsset == null || fileAsset == undefined) { LogUtil.warn(TAG, "Failed to get fileAsset") return; @@ -112,15 +111,16 @@ export class OperationUtils { return numId.valueOf(); } - async getFileAssetById(id,context){ - LogUtil.info(TAG, 'getFileAssetById', id); + async getFileAssetById(imagePath, context){ + LogUtil.info(TAG, 'getFileAssetById', imagePath); let fetchOpt = { - selections : 'file_id =?', - selectionArgs : [`${id}`], + selections : '', + selectionArgs : [], + uri:imagePath } try { - let result = await MediaLibraryAccess.getFirstObject(fetchOpt,context); + let result = await MediaLibraryAccess.getFirstObject(fetchOpt, context); if (result == null) { LogUtil.info(TAG, 'getFileAssetByUri fail'); return null; -- Gitee