Skip to content

wails3 update build-assets leaves stub {{.Ext}}/{{.Role}}/{{.Scheme}} literals when migrating older-format Info.plist #5259

@randalmurphal

Description

@randalmurphal

Description

wails3 update build-assets does not fully process older-format Info.plist templates that use Go-template {{if}}{{range}}{{end}} blocks. The outer directives are stripped, but inner field literals like {{.Ext}}, {{.IconName}}, {{.Name}}, {{.Role}}, {{.Scheme}} remain in the output. The result is a syntactically valid plist that contains garbage placeholder strings — CFBundleDocumentTypes ends up registering a file association for files with extension {{.Ext}}, etc.

The whole point of update:build-assets is to bring an existing project's build assets up to date. If it can't fully migrate older templates, it should warn or error rather than emit silently invalid output.

Reproduction

Tested on v3.0.0-alpha.78 (also reproduces on alpha.76).

  1. Create a fresh project:

    wails3 init -t vanilla -n freshtest
    cd freshtest/build
  2. Replace darwin/Info.plist with an older-format template (representative of what older alpha versions emitted):

    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>CFBundleIconFile</key>
            <string>iconfile</string>
            {{if .Info.FileAssociations}}
            <key>CFBundleDocumentTypes</key>
            <array>
              {{range .Info.FileAssociations}}
              <dict>
                <key>CFBundleTypeExtensions</key>
                <array><string>{{.Ext}}</string></array>
                <key>CFBundleTypeIconFile</key>
                <string>{{.IconName}}</string>
                <key>CFBundleTypeName</key>
                <string>{{.Name}}</string>
                <key>CFBundleTypeRole</key>
                <string>{{.Role}}</string>
              </dict>
              {{end}}
            </array>
            {{end}}
            {{if .Info.Protocols}}
            <key>CFBundleURLTypes</key>
            <array>
              {{range .Info.Protocols}}
              <dict>
                <key>CFBundleURLName</key>
                <string>com.wails.{{.Scheme}}</string>
                <key>CFBundleURLSchemes</key>
                <array><string>{{.Scheme}}</string></array>
                <key>CFBundleTypeRole</key>
                <string>{{.Role}}</string>
              </dict>
              {{end}}
            </array>
            {{end}}
        </dict>
    </plist>
  3. With config.yml in the default state (commented-out fileAssociations and protocols), run:

    wails3 update build-assets -name freshtest -binaryname freshtest -config config.yml -dir .

Observed

Generated Info.plist contains stub literals:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array><string>{{.Ext}}</string></array>
        <key>CFBundleTypeIconFile</key>
        <string>{{.IconName}}</string>
        <key>CFBundleTypeName</key>
        <string>{{.Name}}</string>
        <key>CFBundleTypeRole</key>
        <string>{{.Role}}</string>
    </dict>
</array>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>{{.Role}}</string>
        <key>CFBundleURLName</key>
        <string>com.wails.{{.Scheme}}</string>
        <key>CFBundleURLSchemes</key>
        <array><string>{{.Scheme}}</string></array>
    </dict>
</array>

The outer {{if}}{{range}}{{end}} directives were stripped (so the block renders unconditionally), but the inner {{.Ext}}, {{.IconName}}, {{.Name}}, {{.Role}}, {{.Scheme}} literals were preserved as raw strings.

plutil -lint reports the file as OK (it's valid XML — just contains nonsense strings).

Expected

One of:

  • Old-format {{if .Info.FileAssociations}} blocks evaluated correctly so the block is omitted when the array is empty/null (matching the behavior on a fresh init's new-format template, which correctly omits CFBundleDocumentTypes when there are no fileAssociations).
  • A warning that the template uses an obsolete format and recommending re-scaffold or manual migration.

Impact

Anyone who scaffolded a project on an older alpha and runs update:build-assets to refresh their build assets gets these stubs silently injected. The resulting Info.plist registers nonsense file associations and URL schemes, and the bundle ships to production with garbage in its manifest.

System

  • Wails: v3.0.0-alpha.78 (also v3.0.0-alpha.76)
  • macOS: 26.0
  • Go: 1.25

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingDocumentationImprovements or additions to documentationcliv3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions