"scp/git@code.vereign.com:docker/osticket.git" did not exist on "bb62d566123bfe39e78b3095051d673d5c6e0109"
Newer
Older
// this is a Node module. require is a must to work across different envs
const URL = require("url-parse");
import { normalizeTextSpacings } from "../utils";
export const normalizePlainPart = (text: string): string => {
text = patchOutlookSafelinksWrappers(text);
const patchOutlookSafelinksWrappers = (text: string) => {
const links = text.match(
/<https:.+?(safelinks\.protection\.outlook\.com).+?>/g
);
if (links) {
links.forEach((link) => {
const url = new URL(link.slice(1, link.length - 1), true);
const originalUrl = url.query["url"];
text = text.replace(link, `<${originalUrl}>`);
});
}
return text;
};
/**
* Function removes seal from the plain text.
* Function has to support the next possible file names of the seal:
* qrcode.png, qrcode-xxx.png, seal-xxx.png
* @param s
*/
const removeQRCodes = (s: string): string => {
return s
/\[(image:\s)*(qrcode|seal).*?.png]\s*<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>/g,
/<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>\s*\[(image: )*(qrcode|seal).*?.png]/g,
export const cleanupHiddenCharacters = (s: string): string => {
const removeSymbols = new RegExp(/[\u200B]+/g);
return s.replace(removeSymbols, "");
};