Skip to content

Commit

Permalink
Extend santization regex to support Linux and Mac.
Browse files Browse the repository at this point in the history
Add version and date ISO string to export zip.
  • Loading branch information
truemiller committed Jul 5, 2024
1 parent d6b2d40 commit a31a368
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ function sanitizeLogs({

const logs = filePath ? fs.readFileSync(filePath, 'utf-8') : data;

const usernameRegex = /\/Users\/([^/]+)/g;
const sanitizedData = logs.replace(usernameRegex, '/Users/*****');
const usernameRegex = /\/(Users|home)\/([^/]+)/g;
const sanitizedData = logs.replace(usernameRegex, '/$1/*****');
const sanitizedLogsFilePath = path.join(destPath, name);

if (!fs.existsSync(destPath)) fs.mkdirSync(destPath);
Expand Down Expand Up @@ -666,7 +666,10 @@ ipcMain.handle('save-logs', async (_, data) => {
// Show save dialog
const { filePath } = await dialog.showSaveDialog({
title: 'Save Logs',
defaultPath: path.join(os.homedir(), 'pearl_logs.zip'),
defaultPath: path.join(
os.homedir(),
`pearl_logs_${new Date(Date.now()).toISOString()}-${app.getVersion()}.zip`,
),
filters: [{ name: 'Zip Files', extensions: ['zip'] }],
});

Expand Down

0 comments on commit a31a368

Please sign in to comment.