fix: add more escape chars for multi file auth state

This commit is contained in:
Adhiraj Singh
2022-06-11 19:30:48 +05:30
parent 631bb2ad69
commit a0548fbc4c

View File

@@ -44,14 +44,7 @@ export const useMultiFileAuthState = async(folder: string): Promise<{ state: Aut
await mkdir(folder, { recursive: true }) await mkdir(folder, { recursive: true })
} }
const fixFileName = (file) =>{ const fixFileName = (file?: string) => file?.replace(/\//g, '__')?.replace(/:/g, '-')
if(file){
return file.replace(/:/g, '-');
}
else {
return file
}
}
const creds: AuthenticationCreds = await readData('creds.json') || initAuthCreds() const creds: AuthenticationCreds = await readData('creds.json') || initAuthCreds()
@@ -65,7 +58,7 @@ export const useMultiFileAuthState = async(folder: string): Promise<{ state: Aut
ids.map( ids.map(
async id => { async id => {
let value = await readData(`${type}-${id}.json`) let value = await readData(`${type}-${id}.json`)
if(type === 'app-state-sync-key') { if(type === 'app-state-sync-key' && value) {
value = proto.AppStateSyncKeyData.fromObject(value) value = proto.AppStateSyncKeyData.fromObject(value)
} }