slugify lenient (#25923)
This commit is contained in:
1 parent
b8827aca52
commit
593ed461c8
4 files changed
+27
-6
No files matched your search
@@ -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;
|
||||
@@ -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";
|
||||
|
||||
Reference in new issue
Block a user