From f777518c54649f5237030290ddad88998779a4f2 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Thu, 10 Jul 2025 21:03:42 -0500 Subject: [PATCH] Support pipe character in exif-based urls --- src/photo/db/index.ts | 1 + src/utility/string.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/photo/db/index.ts b/src/photo/db/index.ts index 4c3a8063..e4f180cb 100644 --- a/src/photo/db/index.ts +++ b/src/photo/db/index.ts @@ -11,6 +11,7 @@ const DB_PARAMETERIZE_REPLACEMENTS = [ [',', ''], ['/', ''], ['+', '-'], + ['|', '-'], [' ', '-'], ]; diff --git a/src/utility/string.ts b/src/utility/string.ts index 46dd4527..99b49204 100644 --- a/src/utility/string.ts +++ b/src/utility/string.ts @@ -22,10 +22,10 @@ export const parameterize = ( ) => string .trim() - // Replace spaces, underscores, slashes, pluses, dashes with dashes - .replaceAll(/[\s_–—+]/gi, '-') + // Replace spaces, underscores, slashes, pluses, pipes, dashes with dashes + .replaceAll(/[\s_–—+|]/gi, '-') // Remove punctuation - .replaceAll(/['"!@#$%^&*()=[\]{};:/?,<>\\/|`~]/gi, '') + .replaceAll(/['"!@#$%^&*()=[\]{};:/?,<>\\/`~]/gi, '') // Removes non-alphanumeric characters, if configured .replaceAll( shouldRemoveNonAlphanumeric