You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When dragging a word-document with a "#" at the beginning of the filename into the editor, a link is created.
The file copied to the attachments folder is now an *.png file and opens in image viewer.
The windows image viewer is confused.
Expected behavior
When dragging a word-document with a "#" at the beginning of the filename into the editor, a link to the word-file is created and the file isn't renamed to .png.
Steps to reproduce
Create a new markdown note
Drag a word-file into the editor
Look at the link
Environment
Version : Boostnote 0.13.0
OS Version and name: Windows 10 Pro 64-Bit-Version (10.0. Build 18362)
The text was updated successfully, but these errors were encountered:
I did some research and found the problem in this section of code
Lines 148-177 attachmentManagment.js
function copyAttachment (sourceFilePath, storageKey, noteKey, useRandomName = true) {
return new Promise((resolve, reject) => {
if (!sourceFilePath) {
reject('sourceFilePath has to be given')
}
if (!storageKey) {
reject('storageKey has to be given')
}
if (!noteKey) {
reject('noteKey has to be given')
}
try {
const isBase64 = typeof sourceFilePath === 'object' && sourceFilePath.type === 'base64'
if (!isBase64 && !fs.existsSync(sourceFilePath)) {
return reject('source file does not exist')
}
const sourcePath = sourceFilePath.sourceFilePath || sourceFilePath
const sourceURL = url.parse(/^\w+:\/\//.test(sourcePath) ? sourcePath : 'file:///' + sourcePath)
let destinationName
if (useRandomName) {
destinationName = `${uniqueSlug()}${path.extname(sourceURL.pathname) || '.png'}`
debugger
} else {
destinationName = path.basename(sourceURL.pathname)
}
When a "#" character is used, the sourceURL object is parsed incorrectly, causing the destinationName to use the ".png" extension name. This is due to the url.parse method having built in security to ignore the "#" character as a delimiter nodejs/node-v0.x-archive#711
Flexo013
added
bug 🐛
Issue concerns a bug.
level 1 ❕
A bug that caused minor damage: App is still usable, but minor features might not work.
and removed
needs investigation 🔬
Issue requires further investigation to locate or narrow down the problem.
labels
Jan 28, 2020
Current behavior
When dragging a word-document with a "#" at the beginning of the filename into the editor, a link is created.
The file copied to the attachments folder is now an *.png file and opens in image viewer.
The windows image viewer is confused.
Expected behavior
When dragging a word-document with a "#" at the beginning of the filename into the editor, a link to the word-file is created and the file isn't renamed to .png.
Steps to reproduce
Environment
The text was updated successfully, but these errors were encountered: