mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 10:46:32 +00:00
Replace forbidden filename symbols to _ for image export
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import copyFile from 'browser/main/lib/dataApi/copyFile'
|
import copyFile from 'browser/main/lib/dataApi/copyFile'
|
||||||
import {findStorage} from 'browser/lib/findStorage'
|
import {findStorage} from 'browser/lib/findStorage'
|
||||||
|
import filenamify from 'filenamify'
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
@@ -28,6 +29,7 @@ function exportNote (storageKey, noteContent, targetPath, outputFormatter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let exportedData = noteContent.replace(LOCAL_STORED_REGEX, (match, dstFilename, srcFilename) => {
|
let exportedData = noteContent.replace(LOCAL_STORED_REGEX, (match, dstFilename, srcFilename) => {
|
||||||
|
dstFilename = filenamify(dstFilename, {replacement: '_'})
|
||||||
if (!path.extname(dstFilename)) {
|
if (!path.extname(dstFilename)) {
|
||||||
dstFilename += path.extname(srcFilename)
|
dstFilename += path.extname(srcFilename)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user