Skip to content

Commit

Permalink
Fix over-eager escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm committed Feb 19, 2024
1 parent 8d8c316 commit 51dacd5
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 78 deletions.
48 changes: 24 additions & 24 deletions packages/protobuf-test/src/gen/js/extra/name-clash_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions packages/protobuf-test/src/gen/js/extra/name-clash_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 40 additions & 40 deletions packages/protobuf-test/src/gen/ts/extra/name-clash_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions packages/protobuf/src/private/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ export function localName(
const pkg = desc.file.proto.package;
const offset = pkg.length > 0 ? pkg.length + 1 : 0;
const name = desc.typeName.substring(offset).replace(/\./g, "_");
// For services, we only care about safe identifiers, not safe object properties,
// but we have shipped v1 with a bug that respected object properties, and we
// do not want to introduce a breaking change, so we continue to escape for
// safe object properties.
// See https://github.com/bufbuild/protobuf-es/pull/391
return safeObjectProperty(safeIdentifier(name));
return safeIdentifier(name);
}
case "enum_value": {
const sharedPrefix = desc.parent.sharedPrefix;
Expand Down

0 comments on commit 51dacd5

Please sign in to comment.