feat: prevent html parsing when there is not html
This commit is contained in:
parent
5bf30484b6
commit
3cc2ddc47c
|
|
@ -911,7 +911,7 @@ const CalendarItem: FC<{
|
|||
</div>
|
||||
<div className="w-full relative">
|
||||
<div className="absolute top-0 start-0 w-full text-ellipsis break-words line-clamp-1 text-left">
|
||||
{stripHtmlValidation('none', post.content, false, true) ||
|
||||
{stripHtmlValidation('none', post.content, false, true, false) ||
|
||||
'no content'}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -136,8 +136,14 @@ export const stripHtmlValidation = (
|
|||
val: string,
|
||||
replaceBold = false,
|
||||
none = false,
|
||||
plain = false,
|
||||
convertMentionFunction?: (idOrHandle: string, name: string) => string
|
||||
): string => {
|
||||
|
||||
if (plain) {
|
||||
return val;
|
||||
}
|
||||
|
||||
const value = serialize(parseFragment(val));
|
||||
|
||||
if (type === 'html') {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ type PostWithConditionals = Post & {
|
|||
childrenPost: Post[];
|
||||
};
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class PostsService {
|
||||
private storage = UploadFactory.createStorage();
|
||||
|
|
@ -478,6 +479,7 @@ export class PostsService {
|
|||
p.content,
|
||||
true,
|
||||
false,
|
||||
!(/<\/?[a-z][\s\S]*>/i.test(p.content)),
|
||||
getIntegration.mentionFormat
|
||||
),
|
||||
settings: JSON.parse(p.settings || '{}'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue