Skip to content

Commit

Permalink
Merge pull request #729 from isomerpages/release/0.23.1
Browse files Browse the repository at this point in the history
Release/0.23.1
  • Loading branch information
alexanderleegs authored Apr 24, 2023
2 parents aa1d8d4 + 2147ff6 commit ec3d849
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v0.23.1](https://github.com/isomerpages/isomercms-backend/compare/v0.23.0...v0.23.1)

- hotfix: recursively handle arrays and objects when retrieving frontmatter [`8e236e7`](https://github.com/isomerpages/isomercms-backend/commit/8e236e799445cd411cae4e3f0ceef2bfac05e60b)

#### [v0.23.0](https://github.com/isomerpages/isomercms-backend/compare/v0.22.1...v0.23.0)

> 20 April 2023
- [LS-81] fix(markdown-utils): change sanitization process + add unescape [`#718`](https://github.com/isomerpages/isomercms-backend/pull/718)
- feat(site launch): Allow for ops to remove timed out domain associations [`#720`](https://github.com/isomerpages/isomercms-backend/pull/720)
- style(env var): change naming of var [`#719`](https://github.com/isomerpages/isomercms-backend/pull/719)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "isomercms",
"version": "0.23.0",
"version": "0.23.1",
"private": true,
"scripts": {
"build": "tsc -p tsconfig.build.json",
Expand Down
16 changes: 15 additions & 1 deletion src/utils/markdown-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ const { sanitizer } = require("@services/utilServices/Sanitizer")
const getTrailingSlashWithPermalink = (permalink) =>
permalink.endsWith("/") ? permalink : `${permalink}/`

const recursiveUnescape = (val) => {
if (val === "") return val
if (Array.isArray(val)) {
return val.map(recursiveUnescape)
}
if (typeof val === "object") {
return Object.keys(val).reduce((result, key) => {
result[key] = recursiveUnescape(val[key])
return result
}, {})
}
return _.unescape(val)
}

const retrieveDataFromMarkdown = (fileContent) => {
// eslint-disable-next-line no-unused-vars
const [unused, encodedFrontMatter, ...pageContent] = fileContent.split("---")
Expand All @@ -27,7 +41,7 @@ const retrieveDataFromMarkdown = (fileContent) => {
// so this does not do anything destructive.
// Do note that frontmatter containing pre-existing html encoded characters (&)
// will get transformed regardless.
(val) => _.unescape(val)
(val) => recursiveUnescape(val)
)
const originalPageContent = pageContent.join("---")
// NOTE: We don't sanitize if there is no page content.
Expand Down

0 comments on commit ec3d849

Please sign in to comment.