mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[plugin cli] Stricter path checking, keeps support for file://
This commit is contained in:
parent
f47bc1e802
commit
6bb880165a
1 changed files with 3 additions and 2 deletions
|
@ -6,8 +6,9 @@ import { parse } from 'url';
|
|||
export function _getFilePath(filePath) {
|
||||
const decodedPath = decodeURI(filePath);
|
||||
const isWindows = /^win/.test(process.platform);
|
||||
if (isWindows) {
|
||||
return decodedPath.replace(/^\//, '');
|
||||
const prefixedDrive = /^\/[a-zA-Z]:/.test(decodedPath);
|
||||
if (isWindows && prefixedDrive) {
|
||||
return decodedPath.slice(1);
|
||||
}
|
||||
return decodedPath;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue