• Matan Lurey's avatar
    Always escape when writing pubspec.yaml's 'description' field. (#130096) · 03749051
    Matan Lurey authored
    Closes https://github.com/flutter/flutter/issues/80013.
    
    **Before**:
    
    ```
    $ flutter create test1 --description "a: b"
    Creating project test1...
    Error detected in pubspec.yaml:
    Error on line 2, column 15: Mapping values are not allowed here. Did you miss a colon earlier?
      ╷
    2 │ description: a: b
      │               ^
      ╵
    Please correct the pubspec.yaml file at /Users/matan/Developer/scratch/test1/pubspec.yaml
    ```
    
    **After**:
    
    ```
    $ flutter create test1 --description "a: b"
    Creating project test1...
    Resolving dependencies in test1... 
    Got dependencies in test1.
    Wrote 129 files.
    
    All done!
    You can find general documentation for Flutter at: https://docs.flutter.dev/
    Detailed API documentation is available at: https://api.flutter.dev/
    If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev
    
    In order to run your application, type:
    
      $ cd test1
      $ flutter run
    
    Your application code is in test1/lib/main.dart.
    ```
    
    ---
    
    It's worth noting that this _always_ escapes a non-empty project description, which means that descriptions that were not previously wrapped in `"`s' will be. I'm not sure how worth it is to do a _conditional_ escape (i.e. only escape if not escaping would cause a problem), but willing to change.
    
    Side-note: I had no idea where to list this test in the (very large) `create_test.dart`, so I did my best :)
    03749051
Name
Last commit
Last update
.github Loading commit data...
.vscode Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.ci.yaml Loading commit data...
.cirrus.yml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODEOWNERS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENT_GRANT Loading commit data...
README.md Loading commit data...
TESTOWNERS Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...