Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/src/shared/utils/downloadWGConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import saveAs from 'file-saver';

export const downloadWGConfig = (config: string, fileName: string) => {
const blob = new Blob([config.replace(/^[^\S\r\n]+|[^\S\r\n]+$/gm, '')], {
type: 'text/plain;charset=utf-8',
// octet-stream is used here as a workaround: some browsers will append
// an additional .txt extension to the file name if the MIME type is text/plain.
type: 'application/octet-stream',
});
saveAs(blob, `${fileName.toLowerCase()}.conf`);
};