question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows icon path unquoted, leads to error

See original GitHub issue
  • Version: electron-builder@20.40.2
  • Target: Windows

In my windows configuration, I use the following:

    "win": {
      "target": "zip",
      "icon" : "logos/favicon/Favicon.ico"
    }  

And the release command:

"release": "npm test && npm run generate-license && webpack --config=build/webpack.app.config.js --env=production && electron-builder",

When I run “npm run release”, I get an error because the windows file path is not quoted, so drive “C” is the attempted target for finding an icon:

  • electron-builder version=20.40.2
  • loaded configuration file=package.json ("build" field)
  • no native production dependencies
  • packaging       platform=win32 arch=x64 electron=2.0.2 appOutDir=dist\win-unpacked
Error: Exit code: 1. Command failed: C:\Users\Joe\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.4.0\rcedit-ia32.exe C:\Users\Joe\Documents\Organizations\Satyrn\satyrn\dist\win-unpacked\Satyrn.exe --set-version-string FileDescription Satyrn --set-version-string ProductName Satyrn --set-version-string LegalCopyright Copyright © 2019 Joe Andrieu --set-file-version 0.0.0 --set-product-version 0.0.0.0 --set-version-string InternalName Satyrn --set-version-string OriginalFilename  --set-version-string CompanyName Joe Andrieu --set-icon C:\Users\Joe\Documents\Organizations\Satyrn\satyrn\logos\favicon\Favicon.ico
Reserved header is not 0 or image type is not icon for 'C'
Fatal error: Unable to set icon

Reserved header is not 0 or image type is not icon for 'C'
Fatal error: Unable to set icon

    at C:\Users\Joe\Documents\Organizations\Satyrn\satyrn\node_modules\builder-util\src\util.ts:126:16

[I snipped the rest of the trace]

Note: the constructed file path for the icon is correct. If it were just quoted, I believe this would work.

I looked through the source, but my initial inspection did not find the spot where the command is constructed.

Any pointers would be appreciated.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
lvsouzacommented, Nov 18, 2020

I had this same problem. In my case the problem was in the format of the single image. I used a different converter for the ico format and it worked without problems.

I hope it helps you!

1reaction
cyberdev101commented, May 7, 2022

I had this same problem. In my case the problem was in the format of the single image. I used a different converter for the ico format and it worked without problems.

I hope it helps you!

Thank you so much, this was perfect! This bug should be closed.

Detailed Explanation: When compiling with Electron Packager/Builder, I got this: WARNING: Could not find icon "C:\Users\AM\electron-quick-start\icon.ico", not updating app icon This told me that it was automatically searching for a .ico file. So I decided to rename the file from icon.png to icon.ico. This might of changed the file type, but the binaries of PNG wouldnt be converted to ICO. You need to use an PNG to ICO converter for this. Thank you to @lvsouza for sparking this answer!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix the Windows unquoted service path vulnerability
Log onto the machine which has had the report of the unquoted service path, then open up a command prompt (run as administrator),...
Read more >
Fix unquoted service path for Windows services (Detection ...
But the detection script I currently use seems to not work very well. $value = cmd /c 'wmic service get name,displayname,pathname,startmode | ...
Read more >
Windows Unquoted Service Path Enumeration - Is this still a ...
In simple terms, when a service is created whose executable path contains spaces and isn't enclosed within quotes, leads to a vulnerability known...
Read more >
Microsoft Windows Unquoted Path Vulnerability
The script tries to detect...
Read more >
github/git Checkout Returns 'error: invalid path' on Windows
After researching the error, I've found 2 possible answers: 1) Change the path on the repository file. Unfortunately, this is is a team...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found