Skip to content

Commit

Permalink
fix(amplify-storage-simulator): fixes #3215 Invalid win chars (#3458)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshbhu authored Feb 21, 2020
1 parent fa7d07e commit ddd9512
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/amplify-storage-simulator/src/server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export function parseUrl(request, route: String) {
request.params.path = request.params.path.substring(1);
}

// changing file path by removing invalid file path characters for windows
if (process.platform === 'win32') {
request.params.path = request.params.path.replace(/[<>:"|?*]/g, (match, capture) => '%' + Buffer.from(match, 'utf8').toString('hex'));
}

if (request.method === 'GET') {
if (request.query.prefix !== undefined || (temp[1] === '' && temp[0] === '')) {
request.method = 'LIST';
Expand Down

0 comments on commit ddd9512

Please sign in to comment.