Skip to content

Commit a3c9db3

Browse files
chrisvfritzAkryum
authored andcommitted
fix: only open file if it's a full path (#714)
1 parent 87b9087 commit a3c9db3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/devtools/views/components/ComponentInspector.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<span>Inspect DOM</span>
2727
</a>
2828
<a
29-
v-if="target.file"
30-
v-tooltip="target.file && $t('ComponentInspector.openInEditor.tooltip', { file: target.file })"
29+
v-if="fileIsPath"
30+
v-tooltip="$t('ComponentInspector.openInEditor.tooltip', { file: target.file })"
3131
class="button"
3232
@click="openInEditor"
3333
>
@@ -100,6 +100,12 @@ export default {
100100
[el.key]: el.value
101101
}, this.filter)
102102
})), 'type')
103+
},
104+
105+
// Checks if the file is actually a path (e.g. '/path/to/file.vue'), or
106+
// only the basename of a pre-compiled 3rd-party component (e.g. 'file.vue')
107+
fileIsPath () {
108+
return this.target.file && /[/\\]/.test(this.target.file)
103109
}
104110
},
105111

0 commit comments

Comments
 (0)