This repository was archived by the owner on Jul 26, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,15 @@ import siteConfig from '../config/site.config'
27
27
function mapAbsolutePath ( path : string ) : string {
28
28
// path is in the format of '/drive/root:/path/to/file', if baseDirectory is '/' then we split on 'root:',
29
29
// otherwise we split on the user defined 'baseDirectory'
30
- const absolutePath = path . split ( siteConfig . baseDirectory === '/' ? 'root:' : siteConfig . baseDirectory ) [ 1 ]
30
+ const absolutePath = path . split ( siteConfig . baseDirectory === '/' ? 'root:' : siteConfig . baseDirectory )
31
31
// path returned by the API may contain #, by doing a decodeURIComponent and then encodeURIComponent we can
32
32
// replace URL sensitive characters such as the # with %23
33
- return absolutePath
34
- . split ( '/' )
35
- . map ( p => encodeURIComponent ( decodeURIComponent ( p ) ) )
36
- . join ( '/' )
33
+ return absolutePath . length > 1 // solve https://github.com/spencerwooo/onedrive-vercel-index/issues/539
34
+ ? absolutePath [ 1 ]
35
+ . split ( '/' )
36
+ . map ( p => encodeURIComponent ( decodeURIComponent ( p ) ) )
37
+ . join ( '/' )
38
+ : ''
37
39
}
38
40
39
41
/**
You can’t perform that action at this time.
0 commit comments