slugify lenient (#25923)

This commit is contained in:
Anik Dhabal Babu authored and GitHub committed 2025-12-16 14:01:54 +00:00
1 parent b8827aca52
commit 593ed461c8
4 files changed
+27 -6

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
/**
* Only applies minimal transformations to prevent blocking issues:
* - Removes leading dashes (could break URL parsing)
* - Removes leading periods (could break URL parsing)
* - Removes leading underscores (could break URL parsing)
* - Trims whitespace
*/
export const slugifyLenient = (str: string): string => {
if (!str) {
return "";
}
return str
.trim() // Remove whitespace from both sides
.replace(/^-+/, "") // Remove dashes from start
.replace(/^\.+/, "") // Remove periods from start
.replace(/^_+/, ""); // Remove underscores from start
};
export default slugifyLenient;
+1
View File
@@ -20,6 +20,7 @@ import { paymentDataSelect } from "@calcom/prisma/selects/payment";
import { createNewUsersConnectToOrgIfExists } from "@calcom/trpc/server/routers/viewer/teams/inviteMember/utils";
export { slugify } from "@calcom/lib/slugify";
export { slugifyLenient } from "@calcom/lib/slugify-lenient";
export { getBookingForReschedule };
export type { EventBusyDate } from "@calcom/types/Calendar";