Skip to content

Commit

Permalink
Add path check for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
DanisHaertdinov authored and kicumkicum committed Oct 21, 2021
1 parent ba80c67 commit 041e6bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/routes/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import * as fs from 'fs';
import {ReadStream} from 'fs';

export default {
test: (uri: string): boolean => /^\.|^\//.test(uri) || /^[a-zA-Z]:\\[\\\S|*\S]?.*$/g.test(uri),
test: (uri: string): boolean => {
if (process.platform === 'win32') {
return /^[a-zA-Z]:\\[\\\S|*\S]?.*$/g.test(uri);
}

return /^\.|^\//.test(uri)
},

read: (path: string): Promise<ReadStream> => {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 041e6bf

Please sign in to comment.