-
Notifications
You must be signed in to change notification settings - Fork 15.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix require on network share path #12282
Conversation
lib/renderer/init.js
Outdated
pathname = `//${loc.host}/${pathname}` | ||
} | ||
} else { | ||
pathname = loc.pathname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please initialise let pathname
with window.location.pathname
and do all Windows specific stuff below it? Like this:
const location = window.location
let pathname = location.pathname
if (process.platform === 'win32') {
// Oh crap
...
}
lib/renderer/init.js
Outdated
pathname = loc.pathname.substr(1) | ||
} | ||
|
||
if (loc.hostname.length > 0 && globalPaths[0].startsWith('\\')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have a comment describing (or a link to) an issue this addresses.
Or a simple variable could help too:
const isWindowsNetworkSharePath = location.hostname.length > 0 && globalPaths[0].startsWith('\\')
if (isWindowsNetworkSharePath) {
...
}
We have automatically backported this PR to "1-8-x", please check out #12286 |
We have automatically backported this PR to "2-0-x", please check out #12287 |
* first pass at server/network require fix * refactor for clarity
Closes #12268.
Closes #3043.
This PR fixes an issue such that when an Electron executable is run through a server/network share path formatted as
\\SERVERNAME\appdir\appname.exe
,require
runs intoerrors.
/cc @ckerr