Commit 1e41d41 1 parent 4b2ec9d commit 1e41d41 Copy full SHA for 1e41d41
File tree 1 file changed +10
-4
lines changed
src/miraktest-local/components
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -126,10 +126,16 @@ export const FileSelector: React.VFC<{
126
126
if ( ! path ) {
127
127
return
128
128
}
129
- setFilePath (
130
- // Windows なら file:///C:\path\to\file.m2ts、Linux / Mac なら file:///path/to/file.m2ts になるように加工する
131
- "file:///" + path . at ( 0 ) === "/" ? path . slice ( 1 ) : path
132
- )
129
+ // Windows なら file:///C:\path\to\file.m2ts、Linux / Mac なら file:///path/to/file.m2ts になるように加工する。パスの要素それぞれに対してパーセントエンコードをする
130
+ const url =
131
+ "file:///" +
132
+ path
133
+ . replaceAll ( / \\ / g, "/" )
134
+ . split ( "/" )
135
+ . filter ( ( p ) => p !== "" )
136
+ . map ( ( p ) => encodeURIComponent ( p ) )
137
+ . join ( "/" )
138
+ setFilePath ( url )
133
139
} }
134
140
>
135
141
< File className = "pointer-events-none" size = "1.75rem" />
You can’t perform that action at this time.
0 commit comments