Skip to content
Snippets Groups Projects
Commit 519f962e authored by Igor Markin's avatar Igor Markin
Browse files

Use url-parse in plainnormalizer and fix imports

parent bf32dda2
No related branches found
No related tags found
1 merge request!13Use url parse
import URL from "url-parse";
// this is a Node module. require is a must to work across different envs
const URL = require("url-parse");
const DUMMY_QR_CODE_ID = "dummyQrCode";
......
// this is a Node module. require is a must to work across different envs
const URL = require("url-parse");
import { removeSpacesAndLinebreaks } from "../utils";
export const normalizePlainPart = (text: string): string => {
......@@ -14,8 +17,8 @@ const patchOutlookSafelinksWrappers = (text: string) => {
if (links) {
links.forEach((link) => {
const url = new URL(link.slice(1, link.length - 1));
const originalUrl = url.searchParams.get("url");
const url = new URL(link.slice(1, link.length - 1), true);
const originalUrl = url.query["url"];
text = text.replace(link, `<${originalUrl}>`);
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment