Skip to content

馃悰 Bug Report: CLI ignore patterns with non-ASCII characters never match, so ignored files are deployed聽#2129

Closed

Description

@parth-garg01

馃憻 Reproduction steps

The Go CLI decides what goes into a function or site deployment with internal/ignore (templates/cli/internal/ignore/ignore.go). It handles .gitignore and the ignore field in appwrite.config.json. If a pattern contains any non-ASCII character, it never matches anything.

  1. Create a function directory:
    fn/
      .gitignore      -> "donn茅es/\nsecret-茅.env\n"
      index.js
      donn茅es/prod.env
      secret-茅.env
      secret-e.env
    
  2. Run appwrite functions create-deployment --function-id fn1 --code ./fn --activate true. appwrite push functions uses the same packaging code.
  3. List the uploaded archive. I captured it with a local mock API:
    .gitignore
    donn茅es/prod.env
    index.js
    secret-e.env
    secret-茅.env
    

Cause: translate() loops over the pattern byte by byte and writes regexp.QuoteMeta(string(character)), where character is a byte. In Go, string(byte) converts the byte to a rune. Each byte of a multi-byte UTF-8 character (茅 = C3 A9) therefore turns into a different character (脙, 漏), and the compiled regexp cannot match the real path. The escape branch (\茅) has the same problem.

馃憤 Expected behavior

Patterns match the way the ignore npm package matches them (the package mirrors that library and pins it with testdata/cases.json). ignore@7 reports donn茅es/secret.env, secret-茅.env, x.caf茅 and 鏃ユ湰/a/b.key as ignored for the patterns donn茅es/, secret-茅.env, *.caf茅 and 鏃ユ湰/**/*.key. Those files should be left out of the deployment archive.

馃憥 Actual Behavior

No pattern that contains a non-ASCII character matches. The files they should exclude are packed and uploaded with the deployment. That can include secrets such as .env files kept in a directory with an accented name.

馃幉 Appwrite version

Different version (specify in environment)

馃捇 Operating system

MacOS

馃П Your Environment

The CLI generated from appwrite/sdk-generator main (0955bec). The same code ships in appwrite/sdk-for-cli 28.8.0 (internal/ignore/ignore.go lines 197 and 204). Tested on macOS arm64 with Go 1.26.

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

I have a fix with a regression test ready. Could this be assigned to me so I can open a PR?

Activity

  1. parth-garg01 commented on Oct 22, 2026

    @parth-garg01
    Author

    Hi! I've already got a fix for this with a regression test that fails before the change and passes after it. Could you please assign this issue to me so I can open the PR? Thanks!

  2. ChiragAgg5k commented on Oct 23, 2026

    @ChiragAgg5k
    Member

    Thanks for reporting this. We reproduced the deployment archive issue and fixed it in #2136, included in SDK Generator 5.13.10.

    The generated CLI now preserves Unicode literals and escapes in ignore patterns, including negations. Regression coverage and before/after staging source-archive downloads confirmed that both .gitignore and config ignore rules exclude the intended files and preserve explicitly restored files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions