-
Notifications
You must be signed in to change notification settings - Fork 6
Fixed path extraction for Windows and OSX #13
Conversation
your PR breaks the package 😄 |
Need to update test spec for new code. |
wait I report your fix |
I going to switch on windows to test. |
@ldez Can you check if I did it right in the updated spec? |
It looks like the tests are working as expected now. |
That doesn't work on Win7... You are using Win10? |
why you have removed |
I am testing on Windows 10 and OS X now. It works for both systems for me. What string is Windows 7 using for the path?
|
the
|
currently, we not support this behavior |
clipboardText = windowsFilePattern.exec(clipboardText)[1] | ||
|
||
if clipboardText.match windowsPathPattern | ||
clipboardText = windowsPathPattern.exec(clipboardText)[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rewrite this part like that:
# windows specific
windowsFilePattern = /^file:[\/]{2,3}(.*)$/
windowsPathPattern = /^\"(.*)\"$/
if clipboardText.match windowsFilePattern or clipboardText.match windowsPathPattern
clipboardText = windowsPathPattern.exec(clipboardText)?[1] or windowsFilePattern.exec(clipboardText)?[1]
On Win7 the feature doesn't work because the string is always empty. |
@@ -85,7 +85,17 @@ module.exports = | |||
|
|||
# Image URL support | |||
else if atom.config.get 'asciidoc-image-helper.enableUrlSupport' | |||
clipboardText = clipboard.readText().split(/file:[\/]{2,3}/).join('').replace /^\"|\"$/g, '' | |||
clipboardText = clipboard.readText() | |||
console.log clipboardText |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove console.log
?
Corrects regex for file:\ pattern from #12 and adds in a pattern for matching quoted path string.