wails icon indicating copy to clipboard operation
wails copied to clipboard

Apostrophe in Autogenerated Name Causes Application Crash

Open john-okeefe opened this issue 2 years ago • 4 comments

Description

In the wails.json file, I'm not sure where the author name is being pulled from, but my name (O'Keefe) has an apostrophe in it. When wails generates the field in the json file it comes over as "John O'Keefe". This causes wails dev to crash on launch with ' ERROR invalid character ''' in string escape code'. Removing the '' fixes this and "John O'Keefe" works perfectly.

To Reproduce

  1. Wherever author name is being pulled from add an apostrophe.
  2. Try to run 'wails dev'.
  3. Watch it crash with a generic error that did not point to where the issue was.
  4. Remove the backslash from the author name.
  5. Watch the previous command run perfectly.

Expected behaviour

Script to handle apostrophes correctly.

Screenshots

No response

Attempted Fixes

No response

System Details

Wails Doctor          
                                

                                                                                                                                                     
# Wails
Version         | v2.7.1
Package Manager | zypper

# System
┌────────────────────────────────────────────────────────────────────┐
| OS           | openSUSE Tumbleweed                                 |
| Version      | 20231211                                            |
| ID           | opensuse-tumbleweed                                 |
| Go Version   | go1.21.5                                            |
| Platform     | linux                                               |
| Architecture | amd64                                               |
| CPU 1        | Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz             |
| CPU 2        | Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz             |
| CPU 3        | Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz             |
| CPU 4        | Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz             |
| GPU          | Virtio 1.0 GPU (Red Hat, Inc.) - Driver: virtio-pci |
| Memory       | 12GB                                                |
└────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name            | Status    | Version         |
| *docker    | docker                  | Available | 24.0.7_ce-2.1   |
| gcc        | gcc-c++                 | Installed | 13-1.6          |
| libgtk-3   | gtk3-devel              | Installed | 3.24.38+111-1.1 |
| libwebkit  | webkit2gtk3-soup2-devel | Installed | 2.42.3-1.1      |
| npm        | npm20                   | Installed | 20.8.1-3.1      |
| pkg-config | pkgconf-pkg-config      | Installed | 1.8.0-2.6       |
└───────────────────── * - Optional Dependency ──────────────────────┘

# Diagnosis
Optional package(s) installation details: 
  - docker: sudo zypper in docker

 SUCCESS  Your system is ready for Wails development!

Additional context

No response

john-okeefe avatar Dec 13 '23 20:12 john-okeefe

I'm kind of a newb and not good with testing just yet. If someone wants to fix this I believe it can be easily done.

In the file, v2/cmd/wails/init.go, in the function findAuthorDetails after line 232 add a newline and say, options.AuthorName = strings.Replace(options.AuthorName, "\\", "", -1)

john-okeefe avatar Dec 13 '23 20:12 john-okeefe

Thanks for raising this. Tagging as a good first issue.

leaanthony avatar Dec 15 '23 09:12 leaanthony

Hi I'd like to take this up and fix this.

sbshah97 avatar Dec 20 '23 12:12 sbshah97

Dropped a PR. Would love to continue contributing if that helps.

sbshah97 avatar Dec 20 '23 12:12 sbshah97

@leaanthony @tmclane @sbshah97

After reading sbshah97's comment, I decided to give it a try.

If you have time, please leave a review.

PR: https://github.com/wailsapp/wails/pull/3638

taisei-86 avatar Jul 26 '24 14:07 taisei-86