@electerm/electerm-react 1.37.36 → 1.37.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/common/resolve.js +12 -5
- package/package.json +1 -1
package/client/common/resolve.js
CHANGED
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export default (basePath, nameOrDot) => {
|
|
9
|
-
const sep = basePath.includes('\\') ||
|
|
9
|
+
const sep = (basePath.includes('\\') ||
|
|
10
|
+
basePath.includes(':\\') ||
|
|
11
|
+
/^[a-z]+:$/i.test(basePath) ||
|
|
12
|
+
/^[a-z]+:$/i.test(nameOrDot)
|
|
13
|
+
)
|
|
10
14
|
? '\\'
|
|
11
15
|
: '/'
|
|
12
16
|
if (nameOrDot === '..') {
|
|
@@ -18,12 +22,15 @@ export default (basePath, nameOrDot) => {
|
|
|
18
22
|
const res = arr.slice(0, length - 1).join(sep)
|
|
19
23
|
return res || '/'
|
|
20
24
|
}
|
|
21
|
-
const pre = nameOrDot.includes(':\\') && basePath === '/'
|
|
25
|
+
const pre = (nameOrDot.includes(':\\') || /^[a-z]+:$/i.test(nameOrDot)) && basePath === '/'
|
|
22
26
|
? ''
|
|
23
27
|
: basePath
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
const mid = (basePath.endsWith(sep) ? '' : sep)
|
|
29
|
+
let ff = pre + mid + nameOrDot
|
|
30
|
+
if (/^\\[a-z]+:$/i.test(ff)) {
|
|
31
|
+
ff = ff.slice(1)
|
|
32
|
+
}
|
|
33
|
+
return ff
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
export const osResolve = (...args) => {
|