Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix metadata escaping #8

Merged
merged 17 commits into from May 17, 2023

Conversation

KingGorrin
Copy link

What?

The build fails when merging a branch.

ERROR: lib/utils/metadata.dart:3:33: Error: Expected ';' after this.
ERROR: const String gitCommitMessage = 'Merge branch 'master' into branch-x';

Why?

The build fails when one of the git variables contains special or escape characters like single quotes or \t.

The variables in the metadata.dart file are generated by scripts during the build. Having special characters in the git variables results in an incorrect variable declaration.

Single quotes are used by gitHub when merging a branch, which will generate the following incorrect variable declartion.

// Incorrect variable declaration
const String gitBranchName = 'Merge branch 'master' into branch-x';
const String gitCommitMessage = 'Char test `~!@#$%^&*\t()_+-={}[]:";'|\<>?,./';

How?

By using raw strings, the escape characters are not interpreted and only single quotes need to be replaced with '"'"r'.

// Correct variable declaration
const String gitBranchName = r'Merge branch '"'"r'master'"'"r' into branch-x';
const String gitCommitMessage = r'Char test `~!@#$%^&*\t()_+-={}[]:";'"'"r'|\<>?,./';

@KingGorrin KingGorrin merged commit 44ee684 into hypercore-one:develop May 17, 2023
@KingGorrin KingGorrin deleted the fix-metadata-escaping branch May 28, 2023 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants