Skip to content

Commit 6dc56ec

Browse files
committed
Encode file path as URI + fix console display on Windows
1 parent 1fe68b2 commit 6dc56ec

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/devtools/views/components/ComponentInspector.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ export default {
8585
},
8686
onTitleClick () {
8787
const file = this.target.file
88+
// Console display
89+
const fileName = file.replace(/\\/g, '\\\\')
8890
if (file) {
89-
const src = `fetch('/__open-in-editor?file=${file}').then(response => {
91+
const src = `fetch('/__open-in-editor?file=${encodeURI(file)}').then(response => {
9092
if (response.ok) {
91-
console.log('File ${file} opened in editor')
93+
console.log('File ${fileName} opened in editor')
9294
} else {
93-
const msg = 'Opening component ${file} failed'
95+
const msg = 'Opening component ${fileName} failed'
9496
if (__VUE_DEVTOOLS_TOAST__) {
9597
__VUE_DEVTOOLS_TOAST__(msg, 'error')
9698
} else {
@@ -116,4 +118,3 @@ export default {
116118
cursor pointer
117119
white-space nowrap
118120
</style>
119-

0 commit comments

Comments
 (0)