Skip to content

Commit e4c789a

Browse files
author
Guillaume Chau
authored
501 - Encode file path as URI + fix console display on Windows (vuejs#509)
* Encode file path as URI + fix console display on Windows * Fix rebase * Fix rebase 2
1 parent 334e245 commit e4c789a

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
@@ -99,11 +99,13 @@ export default {
9999
},
100100
openInEditor () {
101101
const file = this.target.file
102-
const src = `fetch('/__open-in-editor?file=${file}').then(response => {
102+
// Console display
103+
const fileName = file.replace(/\\/g, '\\\\')
104+
const src = `fetch('/__open-in-editor?file=${encodeURI(file)}').then(response => {
103105
if (response.ok) {
104-
console.log('File ${file} opened in editor')
106+
console.log('File ${fileName} opened in editor')
105107
} else {
106-
const msg = 'Opening component ${file} failed'
108+
const msg = 'Opening component ${fileName} failed'
107109
if (__VUE_DEVTOOLS_TOAST__) {
108110
__VUE_DEVTOOLS_TOAST__(msg, 'error')
109111
} else {
@@ -127,4 +129,3 @@ export default {
127129
.title
128130
white-space nowrap
129131
</style>
130-

0 commit comments

Comments
 (0)