mirror of
https://gitee.com/openharmony/applications_dlp_manager
synced 2024-11-23 09:59:57 +00:00
commit
f7db952865
@ -33,6 +33,7 @@ import {
|
||||
toggleShow,
|
||||
directionStatus,
|
||||
getTime,
|
||||
isValidPath,
|
||||
sendDlpManagerFileConfiguration
|
||||
} from '../common/utils';
|
||||
import { DlpAlertDialog } from '../common/components/dlp_alert_dialog';
|
||||
@ -216,6 +217,10 @@ struct changeEncryption {
|
||||
HiLog.info(TAG, `Decrypt DLP file: ${this.srcFileName}`);
|
||||
try {
|
||||
let srcFileUri: string = GlobalContext.load('uri');
|
||||
if (!isValidPath(srcFileUri)) {
|
||||
HiLog.error(TAG, `uri is invalid`);
|
||||
return;
|
||||
}
|
||||
let srcFileMsg: FileMsg = FileUtils.getAllSuffixByUri(srcFileUri);
|
||||
let documentSaveOptions = new picker.DocumentSaveOptions();
|
||||
documentSaveOptions.newFileNames = [decodeURIComponent(plaintextFile)];
|
||||
@ -245,6 +250,10 @@ struct changeEncryption {
|
||||
|
||||
async fileDecryption(saveRes: Array<string>): Promise<void> {
|
||||
let plainUri = saveRes[0];
|
||||
if (!isValidPath(plainUri)) {
|
||||
HiLog.error(TAG, `pick save uri is invalid`);
|
||||
return;
|
||||
}
|
||||
let uriInfo: fileUri.FileUri | undefined = undefined;
|
||||
let file: fs.File | undefined = undefined;
|
||||
try {
|
||||
|
@ -37,6 +37,7 @@ import {
|
||||
getFileUriByPath,
|
||||
sendDlpFileCreateProperties,
|
||||
sendDlpManagerFileConfiguration,
|
||||
isValidPath,
|
||||
getFileSizeByUri
|
||||
} from '../common/utils';
|
||||
import Constants from '../common/constant';
|
||||
@ -366,6 +367,10 @@ struct DlpDialog {
|
||||
await this.setUserStat();
|
||||
try {
|
||||
let srcFileUri: string = GlobalContext.load('uri');
|
||||
if (!isValidPath(srcFileUri)) {
|
||||
HiLog.error(TAG, `uri is invalid`);
|
||||
return;
|
||||
}
|
||||
let srcFileMsg: FileMsg = FileUtils.getSuffixFileMsgByUri(srcFileUri);
|
||||
let srcFileSize: number = await getFileSizeByUri(srcFileUri);
|
||||
AppStorage.setOrCreate('hiFileSize', srcFileSize);
|
||||
@ -385,6 +390,10 @@ struct DlpDialog {
|
||||
}
|
||||
HiLog.info(TAG, `get uri success`);
|
||||
uri = saveRes[0];
|
||||
if (!isValidPath(uri)) {
|
||||
HiLog.error(TAG, `pick save uri is invalid`);
|
||||
return;
|
||||
}
|
||||
let uriInfo: fileUri.FileUri = new fileUri.FileUri('');
|
||||
try {
|
||||
uriInfo = new fileUri.FileUri(uri);
|
||||
|
Loading…
Reference in New Issue
Block a user