File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,12 @@ async function generateSchema(pathToSpec) {
108
108
let outputFilePath = new URL ( flags . output , CWD ) ; // note: may be directory
109
109
const isDir = fs . existsSync ( outputFilePath ) && fs . lstatSync ( outputFilePath ) . isDirectory ( ) ;
110
110
if ( isDir ) {
111
- const filename = pathToSpec . replace ( EXT_RE , ".ts" ) . replace ( / ^ h t t p s ? : \/ \/ / , '' ) ;
112
- outputFilePath = new URL ( filename , outputFilePath ) ;
111
+ const filename = pathToSpec . replace ( EXT_RE , ".ts" ) ;
112
+ const originalOutputFilePath = outputFilePath ;
113
+ outputFilePath = new URL ( filename , originalOutputFilePath ) ;
114
+ if ( outputFilePath . protocol !== 'file' ) {
115
+ outputFilePath = new URL ( outputFilePath . host . replace ( EXT_RE , ".ts" ) , originalOutputFilePath ) ;
116
+ }
113
117
}
114
118
115
119
fs . writeFileSync ( outputFilePath , result , "utf8" ) ;
You can’t perform that action at this time.
0 commit comments