1e41f4b71Sopenharmony_ci# File Subsystem Changelog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.file.1 Change of the userFileManager FileAsset Attribute 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciChanged the [userFileManager.FileAsset](../../../application-dev/reference/apis/js-apis-userFileManager.md#fileasset) attribute. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciURI format before the change: 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci'file://media/\<file_type\>/\<file_id\>/?networkid=xxx' 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciURI format after the change: 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci'file://media/Photo/\<id\>/IMG_datetime_0001/displayName.jpg' 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci**Change Impact** 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ciFor applications developed based on earlier versions, check whether the applications depend on or parse the media library URIs. If yes, make adaptation as required. The value of **file_id** is not unique. Do not parse the file ID. Use the URI instead. 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**Key API/Component Changes** 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci| Module | Method/Attribute/Enum/Constant | Change Type| 22e41f4b71Sopenharmony_ci| ------------------------- | ------------------------------------------------------------ | -------- | 23e41f4b71Sopenharmony_ci| userFileManager | **interface** FileAsset | Attribute changed | 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci**Adaptation Guide** 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ciIn API version 10, the URI format of user files is changed so that basic file information (such as the file name) can be obtained based on the URI. If the new format is used, the URI parsing may yield unexpected result. For example, before the change, the ID obtained from the URI **'file://media/image/8'** is 8. If the new URI format is used, the file **displayName** is obtained. You are advised to use the URI to obtain file information. 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci**Example**: 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci```js 32e41f4b71Sopenharmony_ciimport userFileManager from '@ohos.filemanagement.userFileManager'; 33e41f4b71Sopenharmony_ciimport dataSharePredicates from '@ohos.data.dataSharePredicates'; 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ciasync function example() { 36e41f4b71Sopenharmony_ci let context = getContext(this); 37e41f4b71Sopenharmony_ci let mgr = userFileManager.getUserFileMgr(context); 38e41f4b71Sopenharmony_ci let predicates = new dataSharePredicates.DataSharePredicates(); 39e41f4b71Sopenharmony_ci let uri = 'file://media/Photo/1/IMG_datetime_0001/displayName.jpg' // The URI must exist. 40e41f4b71Sopenharmony_ci predicates.equalTo('uri', uri); 41e41f4b71Sopenharmony_ci let fetchOptions = { 42e41f4b71Sopenharmony_ci fetchColumns: ['uri'], 43e41f4b71Sopenharmony_ci predicates: predicates 44e41f4b71Sopenharmony_ci }; 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci mgr.getPhotoAssets(fetchOptions, async (err, fetchResult) => { 47e41f4b71Sopenharmony_ci if (fetchResult != undefined) { 48e41f4b71Sopenharmony_ci console.info('fetchResult success'); 49e41f4b71Sopenharmony_ci let fileAsset = await fetchResult.getFirstObject(); 50e41f4b71Sopenharmony_ci if (fileAsset != undefined) { 51e41f4b71Sopenharmony_ci console.info('fileAsset.displayName : ' + fileAsset.displayName); 52e41f4b71Sopenharmony_ci } 53e41f4b71Sopenharmony_ci } else { 54e41f4b71Sopenharmony_ci console.error('fetchResult fail' + err); 55e41f4b71Sopenharmony_ci } 56e41f4b71Sopenharmony_ci }); 57e41f4b71Sopenharmony_ci} 58e41f4b71Sopenharmony_ci``` 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ci## cl.file.2 Change of the photoAccessHelper PhotoAsset Attribute 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ciChanged the [photoAccessHelper.PhotoAsset](../../../application-dev/reference/apis/js-apis-photoAccessHelper.md#photoasset) attribute. 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_ciURI format before the change: 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ci'file://media/\<file_type\>/\<file_id\>/?networkid=xxx' 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ciURI format after the change: 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci'file://media/Photo/\<id\>/IMG_datetime_0001/displayName.jpg' 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci**Change Impact** 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ciFor applications developed based on earlier versions, check whether the applications depend on or parse the media library URIs. If yes, make adaptation as required. The value of **file_id** is not unique. Do not parse the file ID. Use the URI instead. 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci**Key API/Component Changes** 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci| Module | Method/Attribute/Enum/Constant | Change Type| 79e41f4b71Sopenharmony_ci| ------------------------- | ------------------------------------------------------------ | -------- | 80e41f4b71Sopenharmony_ci| photoAccessHelper | **interface** PhotoAsset | Attribute changed | 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci**Adaptation Guide** 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ciIn API version 10, the URI format of user files is changed so that basic file information (such as the file name) can be obtained based on the URI. If the new format is used, the URI parsing may yield unexpected result. For example, before the change, the ID obtained from the URI **'file://media/image/8'** is 8. If the new URI format is used, the file **displayName** is obtained. You are advised to use the URI to obtain file information. 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ci**Example**: 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci```js 89e41f4b71Sopenharmony_ciimport photoAccessHelper from '@ohos.file.photoAccessHelper'; 90e41f4b71Sopenharmony_ciimport dataSharePredicates from '@ohos.data.dataSharePredicates'; 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ciasync function example() { 93e41f4b71Sopenharmony_ci let context = getContext(this); 94e41f4b71Sopenharmony_ci let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context); 95e41f4b71Sopenharmony_ci let predicates = new dataSharePredicates.DataSharePredicates(); 96e41f4b71Sopenharmony_ci let uri = 'file://media/Photo/1/IMG_datetime_0001/displayName.jpg' // The URI must exist. 97e41f4b71Sopenharmony_ci predicates.equalTo('uri', uri); 98e41f4b71Sopenharmony_ci let fetchOptions = { 99e41f4b71Sopenharmony_ci fetchColumns: ['uri'], 100e41f4b71Sopenharmony_ci predicates: predicates 101e41f4b71Sopenharmony_ci }; 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ci phAccessHelper.getAssets(fetchOptions, async (err, fetchResult) => { 104e41f4b71Sopenharmony_ci if (fetchResult != undefined) { 105e41f4b71Sopenharmony_ci console.info('fetchResult success'); 106e41f4b71Sopenharmony_ci let photoAsset = await fetchResult.getFirstObject(); 107e41f4b71Sopenharmony_ci if (photoAsset != undefined) { 108e41f4b71Sopenharmony_ci console.info('photoAsset.displayName : ' + photoAsset.displayName); 109e41f4b71Sopenharmony_ci } 110e41f4b71Sopenharmony_ci } else { 111e41f4b71Sopenharmony_ci console.error('fetchResult fail' + err); 112e41f4b71Sopenharmony_ci } 113e41f4b71Sopenharmony_ci }); 114e41f4b71Sopenharmony_ci} 115e41f4b71Sopenharmony_ci``` 116