File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ import GetPageProps from "./GetPageProps";
44import MediaModel from "./model" ;
55import { Constants , type MediaWithUserId } from "@medialit/models" ;
66
7+ function escapeRegex ( value : string ) : string {
8+ return value . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, "\\$&" ) ;
9+ }
10+
711export async function getMedia ( {
812 userId,
913 apikey,
@@ -89,8 +93,8 @@ export async function getPaginatedMedia({
8993 ? Constants . AccessControl . PRIVATE
9094 : Constants . AccessControl . PUBLIC ;
9195 }
92- if ( group ) {
93- query . group = group ;
96+ if ( typeof group === "string" && group . trim ( ) . length > 0 ) {
97+ query . group = { $regex : `^ ${ escapeRegex ( group . trim ( ) ) } ` } ;
9498 }
9599 const limitWithFallback = recordsPerPage || numberOfRecordsPerPage ;
96100
You can’t perform that action at this time.
0 commit comments