2023-02-16 22:39:57 +00:00
|
|
|
import type { DAVObject } from "tsdav";
|
2022-08-25 09:18:30 +00:00
|
|
|
|
|
|
|
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;
|