13 lines
380 B
TypeScript
13 lines
380 B
TypeScript
|
import { DAVObject } from "tsdav";
|
||
|
|
||
|
export const sanitizeCalendarObject = (obj: DAVObject) => {
|
||
|
return obj.data
|
||
|
.replaceAll("\r\n", "\r")
|
||
|
.replaceAll("\r", "\r\n")
|
||
|
.replaceAll(/(: \r\n|:\r\n|\r\n:|\r\n :)/gm, ":")
|
||
|
.replaceAll(/(; \r\n|;\r\n|\r\n;|\r\n ;)/gm, ";")
|
||
|
.replaceAll(/(= \r\n|=\r\n|\r\n=|\r\n =)/gm, "=");
|
||
|
};
|
||
|
|
||
|
export default sanitizeCalendarObject;
|