mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	replace RE2 with RegExp for regex word mute validation
This commit is contained in:
		
							parent
							
								
									d14f0b140b
								
							
						
					
					
						commit
						9160ede4d5
					
				
					 1 changed files with 1 additions and 2 deletions
				
			
		| 
						 | 
					@ -3,7 +3,6 @@
 | 
				
			||||||
 * SPDX-License-Identifier: AGPL-3.0-only
 | 
					 * SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import RE2 from 're2';
 | 
					 | 
				
			||||||
import * as mfm from '@transfem-org/sfm-js';
 | 
					import * as mfm from '@transfem-org/sfm-js';
 | 
				
			||||||
import { Inject, Injectable } from '@nestjs/common';
 | 
					import { Inject, Injectable } from '@nestjs/common';
 | 
				
			||||||
import ms from 'ms';
 | 
					import ms from 'ms';
 | 
				
			||||||
| 
						 | 
					@ -325,7 +324,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
					if (!regexp) throw new ApiError(meta.errors.invalidRegexp);
 | 
										if (!regexp) throw new ApiError(meta.errors.invalidRegexp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					try {
 | 
										try {
 | 
				
			||||||
						new RE2(regexp[1], regexp[2]);
 | 
											new RegExp(regexp[1], regexp[2]);
 | 
				
			||||||
					} catch (err) {
 | 
										} catch (err) {
 | 
				
			||||||
						throw new ApiError(meta.errors.invalidRegexp);
 | 
											throw new ApiError(meta.errors.invalidRegexp);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue