Skip to content

Commit

Permalink
fix(HtmlSerializer)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Dec 9, 2023
1 parent d6f7941 commit 24f545c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/lib/serializers/Html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ class HtmlSerializer implements Serializer {

deserialize(html): Folder {
const folders: Folder[] = parseByString(html)
if (folders.length === 1) {
folders[0].isRoot = true
return folders[0]
} else {
folders.forEach(f => f.parentId = '0')
return new Folder({id: '0', title: 'root', children: folders, location: ItemLocation.SERVER, isRoot: true})
}
folders.forEach(f => {f.parentId = '0'})
return new Folder({id: '0', title: 'root', children: folders, location: ItemLocation.SERVER, isRoot: true})
}
}

Expand Down Expand Up @@ -79,7 +74,7 @@ export const getRootFolder = (body: cheerio.Cheerio<cheerio.Element>) => {

export const parseByString = (content: string) => {
const $ = cheerio.load(content, {
decodeEntities: false
decodeEntities: true
})

const body = $('body')
Expand Down

0 comments on commit 24f545c

Please sign in to comment.