Skip to content

Commit 954d33a

Browse files
authored
Merge pull request #459 from keyser84/fix_backup_suggested_filename
Replace invalid filesystem characters in suggested backup filename
2 parents 8d43a60 + b8b5ee9 commit 954d33a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

js/backup_restore.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,15 @@ function configuration_backup(callback) {
164164
var chosenFileEntry = null;
165165

166166
var accepts = [{
167-
extensions: ['txt']
167+
extensions: ['json']
168168
}];
169169

170170
// generate timestamp for the backup file
171171
var now = new Date().toISOString().split(".")[0];
172172

173+
// replace invalid filesystem characters
174+
now = now.replace(new RegExp(':', 'g'), '_');
175+
173176
// create or load the file
174177
chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: 'betaflight_backup_' + now + '.json', accepts: accepts}, function (fileEntry) {
175178
if (chrome.runtime.lastError) {

0 commit comments

Comments
 (0)