Skip to content

Commit

Permalink
fix: sanitize descriptions
Browse files Browse the repository at this point in the history
closes #5, resolves #4 - thanks to @Fermain
  • Loading branch information
davidenke committed Dec 17, 2024
1 parent 91a2d21 commit 6c0b848
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/transform.utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type * as Decap from 'decap-cms-core';

import { transformObjectField } from '../transformers/field-object.transform.js';
import { escapeString } from './format.utils.js';

/**
* Utility type defining a transformer function.
Expand Down Expand Up @@ -64,7 +65,7 @@ export function applyDescription(field: Decap.CmsField, result: TransformResult)

// set a description
return {
compiled: `${result.compiled}.describe('${description}')`,
compiled: `${result.compiled}.describe('${escapeString(description)}')`,
dependencies: ['z', ...result.dependencies],
};
}
Expand Down

0 comments on commit 6c0b848

Please sign in to comment.