fix(backend): replace slug package with slugify (#8807)

* replace slug with slugify

* replace slug with slugify in root package.json

* remove undocumented characters

---------

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
This commit is contained in:
Ulf Gebhardt 2025-08-07 10:44:19 +01:00 committed by GitHub
parent e0017bc4dd
commit 1612d03b52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 17 additions and 15 deletions

View File

@ -84,7 +84,7 @@
"preview-email": "^3.1.0",
"pug": "^3.0.3",
"sanitize-html": "~2.17.0",
"slug": "~9.1.0",
"slugify": "^1.6.6",
"trunc-html": "~1.1.2",
"tslog": "^4.9.3",
"uuid": "~9.0.1",

View File

@ -7,7 +7,7 @@
import { faker } from '@faker-js/faker'
import { hashSync } from 'bcryptjs'
import { Factory } from 'rosie'
import slugify from 'slug'
import slugify from 'slugify'
import { v4 as uuid } from 'uuid'
import { generateInviteCode } from '@graphql/resolvers/inviteCodes'

View File

@ -1,7 +1,7 @@
import path from 'node:path'
import { UserInputError } from 'apollo-server-express'
import slug from 'slug'
import slug from 'slugify'
import { v4 as uuid } from 'uuid'
import type { S3Config } from '@config/index'

View File

@ -2,7 +2,7 @@ import path from 'node:path'
import { UserInputError } from 'apollo-server'
import { FileUpload } from 'graphql-upload'
import slug from 'slug'
import slug from 'slugify'
import { v4 as uuid } from 'uuid'
import type { S3Config } from '@config/index'

View File

@ -1,10 +1,12 @@
import slugify from 'slug'
import slugify from 'slugify'
slugify.extend({ Ä: 'AE', ä: 'ae', Ö: 'OE', ö: 'oe', Ü: 'UE', ü: 'ue', ß: 'ss' })
type IsUnique = (slug: string) => Promise<boolean>
export default async function uniqueSlug(str: string, isUnique: IsUnique) {
const slug = slugify(str || 'anonymous', {
lower: true,
multicharmap: { Ä: 'AE', ä: 'ae', Ö: 'OE', ö: 'oe', Ü: 'UE', ü: 'ue', ß: 'ss' },
remove: /[*+~.()'"!:@]/g,
})
if (await isUnique(slug)) return slug

View File

@ -10398,10 +10398,10 @@ slug@^8.2.2:
resolved "https://registry.yarnpkg.com/slug/-/slug-8.2.2.tgz#33b019a857a11fc4773c1e9a9f60e3da651a9e5d"
integrity sha512-5ByW6qXqPeG0Tmlkh24JhdXhvQsbaJSjVr3GgGxUV0BSskZKKBZZfFWxezap8+fh1vxBN9GVbqI1V6nqAFxlBg==
slug@~9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/slug/-/slug-9.1.0.tgz#246baf1e9d8e821f7f5863a7c8bdd86a7ec3f12c"
integrity sha512-ioOsCfzQSu+D6NZ8XMCR8IW9FgvF8W7Xzz56hBkB/ALvNaWeBs2MUvvPugq3GCrxfHPFeK6hAxGkY/WLnfX2Lg==
slugify@^1.6.6:
version "1.6.6"
resolved "https://registry.yarnpkg.com/slugify/-/slugify-1.6.6.tgz#2d4ac0eacb47add6af9e04d3be79319cbcc7924b"
integrity sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==
smart-buffer@^4.2.0:
version "4.2.0"

View File

@ -55,7 +55,7 @@
"neo4j-driver": "^4.3.4",
"neode": "^0.4.8",
"rosie": "^2.1.0",
"slug": "^10.0.0"
"slugify": "^1.6.6"
},
"optionalDependencies": {
"@vuepress/bundler-vite": "^2.0.0-rc.18",

View File

@ -7743,10 +7743,10 @@ slimsearch@^2.1.1:
resolved "https://registry.npmjs.org/slimsearch/-/slimsearch-2.1.1.tgz"
integrity sha512-l1utJWal8F/RIheYk88DE2+enI12nIrn5SHt4ih/CNAH81PzkTv2GVBODlLynDJb7xan5hjd8XTL5f0L4cxLQA==
slug@^10.0.0:
version "10.0.0"
resolved "https://registry.npmjs.org/slug/-/slug-10.0.0.tgz"
integrity sha512-M8s2PWOUeSCdD4S1NH5lCzXg2zFV1fozrtfr0FSKl65x+EF1rUowj+/vyFlnHgxPxWzT+DL0VXKfYc1DHJoymg==
slugify@^1.6.6:
version "1.6.6"
resolved "https://registry.yarnpkg.com/slugify/-/slugify-1.6.6.tgz#2d4ac0eacb47add6af9e04d3be79319cbcc7924b"
integrity sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==
source-map-js@^1.2.0, source-map-js@^1.2.1:
version "1.2.1"