File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { StoreType as RustSdkCryptoStoreType } from "@matrix-org/matrix-sdk-cryp
1111import { ICryptoStorageProvider } from "./ICryptoStorageProvider" ;
1212import { IAppserviceCryptoStorageProvider } from "./IAppserviceStorageProvider" ;
1313import { ICryptoRoomInformation } from "../e2ee/ICryptoRoomInformation" ;
14+ import { LogService } from "../logging/LogService" ;
1415
1516export { RustSdkCryptoStoreType } ;
1617
@@ -59,10 +60,12 @@ export class RustSdkCryptoStorageProvider implements ICryptoStorageProvider {
5960 // No machine files at all, we can skip.
6061 return newPath ;
6162 }
62-
63+ const legacyDeviceId = await this . getDeviceId ( ) ;
6364 // We need to move the file.
64- await mkdir ( newPath ) ;
65- await rename ( legacyFilePath , path . join ( newPath , 'matrix-sdk-crypto.sqlite3' ) ) ;
65+ const previousDevicePath = path . join ( this . storagePath , sha256 ( ) . update ( legacyDeviceId ) . digest ( 'hex' ) ) ;
66+ LogService . warn ( "RustSdkCryptoStorageProvider" , `Migrating path for SDK database for legacy device ${ legacyDeviceId } ` ) ;
67+ await mkdir ( previousDevicePath ) ;
68+ await rename ( legacyFilePath , path . join ( previousDevicePath , 'matrix-sdk-crypto.sqlite3' ) ) ;
6669 return newPath ;
6770 }
6871
You can’t perform that action at this time.
0 commit comments