Skip to content
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

[Bug]: BrowserWindow.webPreferences.additionalArguments cannot contain a "\" (broken since v14.x.y) #32064

Closed
3 tasks done
reZach opened this issue Nov 30, 2021 · 4 comments
Closed
3 tasks done
Labels
14-x-y bug 🪲 has-repro-comment Issue has repro in comments has-repro-repo Issue can be reproduced by cloning a git repo stale

Comments

@reZach
Copy link

reZach commented Nov 30, 2021

Preflight Checklist

Electron Version

14.0.0

What operating system are you using?

Windows

Operating System Version

Windows 10 Pro Version 20H2

What arch are you using?

x64

Last Known Working Electron version

13.3.0

Expected Behavior

I expect that I am able to pass in a string into additionalArguments that contains a "\". This functionality is no longer working in v14.0.0 (I also tested and see that it is broken in v16.0.0 as well).

Sample snippet (full repo is in "Additional Information" section)

let win = new BrowserWindow({
    width: 800,
    height: 600,
    title: "Title",
    webPreferences: {      
      additionalArguments: ["test"], // okay      
      additionalArguments: [`path:${app.getPath("userData")}`], // breaks
      preload: path.join(__dirname, "preload.js")      
    }
  });

Actual Behavior

I piggy-back off of additionalArguments in order to send a filepath to code that executes in the preload script.

I expect this to work

let win = new BrowserWindow({
    width: 800,
    height: 600,
    title: "Title",
    webPreferences: {      
      additionalArguments: [`path:${app.getPath("userData")}`],
      preload: path.join(__dirname, "preload.js")      
    }
  });

Testcase Gist URL

No response

Additional Information

Problem file in repo exists @app/electron/main.js

Steps to repro

git clone https://github.com/reZach/bad-upgrade.git
cd bad-upgrade
npm i
npm run dev
@reZach
Copy link
Author

reZach commented May 25, 2022

@jkleinsc checking in - has there been any progress on this?

@Arkellys
Copy link

Arkellys commented Aug 7, 2022

I have a similar problem with Electron 19.0.4, except it's not the \ that breaks it but the prefix used.

additionalArguments: ["test\\"] // Works
additionalArguments: [app.getPath("userData")] // Works
additionalArguments: [`appFolderPath=${app.getPath("userData")}`] // Doesn't work

I managed to make it work only when I write the prefix starting with a specific pattern, either X: or -- (like the other arguments):

additionalArguments: [`X:${app.getPath("userData")}`]
additionalArguments: [`P:ath=${app.getPath("userData")}`]
additionalArguments: [`--appFolderPath=${app.getPath("userData")}`]

Is this a bug or is there a reason for it?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2022

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Nov 6, 2022
@github-actions
Copy link
Contributor

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
14-x-y bug 🪲 has-repro-comment Issue has repro in comments has-repro-repo Issue can be reproduced by cloning a git repo stale
Projects
None yet
Development

No branches or pull requests

3 participants