Skip to content

Commit

Permalink
Fix validation for service id with unusual characters (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ndpnt authored Feb 20, 2024
2 parents 63991a0 + 047986d commit 472ec3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## Unreleased [patch]

_Full changeset and discussions: [#1056](https://github.com/OpenTermsArchive/engine/pull/1056)._

> Development of this release was supported by the [French Ministry for Foreign Affairs](https://www.diplomatie.gouv.fr/fr/politique-etrangere-de-la-france/diplomatie-numerique/) through its ministerial [State Startups incubator](https://beta.gouv.fr/startups/open-terms-archive.html) under the aegis of the Ambassador for Digital Affairs.
### Fixed

- Fix support of service names with special character in the validation CLI

## 0.37.0 - 2024-02-20

Expand Down
4 changes: 2 additions & 2 deletions scripts/declarations/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default class DeclarationUtils {
}

async getModifiedData() {
const modifiedFilePathsAsString = (await this.git.diff([ '--diff-filter=d', '--name-only', this.defaultBranch, 'HEAD', '--', './declarations' ])).trim();
const modifiedFilePathsAsString = (await this.git.diff([ '-z', '--diff-filter=d', '--name-only', this.defaultBranch, 'HEAD', '--', './declarations' ])).trim(); // -z option is required to avoid pathnames with "unusual" characters to be quoted, but it also replaces result separator by the zero byte character \0

const modifiedFilePaths = modifiedFilePathsAsString ? modifiedFilePathsAsString.split('\n') : [];
const modifiedFilePaths = (modifiedFilePathsAsString ? modifiedFilePathsAsString.split('\0') : []).filter(str => str !== ''); // split on \0 rather than \n due to the -z option of git diff

return { modifiedFilePaths, modifiedServicesIds: Array.from(new Set(modifiedFilePaths.map(DeclarationUtils.filePathToServiceId))) };
}
Expand Down

0 comments on commit 472ec3c

Please sign in to comment.