rename sanitize function to singular

This commit is contained in:
Abhinav-grd 2021-04-04 13:53:00 +05:30 committed by GitHub
parent 3dfe084850
commit ad3faec8a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,7 @@ class ExportService {
for (let collection of collections) { for (let collection of collections) {
let collectionFolderPath = `${dir}/${ let collectionFolderPath = `${dir}/${
collection.id collection.id
}_${this.sanitizeNames(collection.name)}`; }_${this.sanitizeName(collection.name)}`;
await this.ElectronAPIs.checkExistsAndCreateCollectionDir( await this.ElectronAPIs.checkExistsAndCreateCollectionDir(
collectionFolderPath collectionFolderPath
); );
@ -80,14 +80,13 @@ class ExportService {
async downloadAndSave(file: file, path) { async downloadAndSave(file: file, path) {
const fileStream = await downloadManager.downloadFile(file); const fileStream = await downloadManager.downloadFile(file);
this.ElectronAPIs.saveStreamToDisk(path, fileStream); this.ElectronAPIs.saveStreamToDisk(path, fileStream);
this.ElectronAPIs.saveFileToDisk( this.ElectronAPIs.saveFileToDisk(
`${path}.json`, `${path}.json`,
JSON.stringify(file.metadata, null, 2) JSON.stringify(file.metadata, null, 2)
); );
} }
private sanitizeNames(name) { private sanitizeName(name) {
return name.replaceAll('/', '_').replaceAll(' ', '_'); return name.replaceAll('/', '_').replaceAll(' ', '_');
} }
} }