Skip to content

Commit

Permalink
Path fix for windows - leading slash
Browse files Browse the repository at this point in the history
Looks like there is some junk with Windows paths. To put it simply, the
following call is an Identity operation under Linux, but leaves a
leading slash under Windows:

url.parse( url.format( { pathname: path.join(process.cwd(), 'got_access_token.html'), protocol: 'elif:', slashes: true } )).pathname

On windows you get '/E:/some/path/...' - note the leading slash.

Some discussions here:
  nodejs/node#10703
  nodejs/node#10739

Dunno! I just fixed it by hand.
  • Loading branch information
Ivan Dobrianov committed Apr 21, 2018
1 parent e2ab241 commit 5c09410
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ app.on('ready', () => {

// Chromium prevents redir to file://. See https://github.com/electron/electron/issues/9077
electron.protocol.registerFileProtocol('elif', (request, callback) => {
const path = url.parse(request.url).pathname;
const path = url.parse(request.url).pathname.replace(/^\/(\w:)/, '$1');
callback({ path });
}, (error) => {
if (error) console.error('Failed to register protocol');
Expand Down

0 comments on commit 5c09410

Please sign in to comment.