@@ -176,20 +176,25 @@ def remove_tags(data):
176
176
return data .replace (settings .INJECT_TAG ,"" ).replace (settings .CUSTOM_INJECTION_MARKER_CHAR ,"" ).replace (settings .ASTERISK_MARKER , "" ).replace (settings .RANDOM_TAG , "" )
177
177
178
178
"""
179
- Process data with custom injection marker character ('*').
179
+ Process data with custom injection marker character ('*')
180
180
"""
181
181
def process_custom_injection_data (data ):
182
- if settings .CUSTOM_INJECTION_MARKER != None and isinstance (data , str ):
183
- _ = []
184
- for data in data .split ("\\ n" ):
185
- if not data .startswith (settings .ACCEPT ) and settings .CUSTOM_INJECTION_MARKER_CHAR in data :
186
- if menu .options .test_parameter != None and settings .CUSTOM_INJECTION_MARKER == False :
187
- data = remove_tags (data )
188
- # elif settings.CUSTOM_INJECTION_MARKER:
189
- data = data .replace (settings .CUSTOM_INJECTION_MARKER_CHAR , settings .ASTERISK_MARKER )
190
- _ .append (data )
191
- data = "\\ n" .join ((list (dict .fromkeys (_ )))).rstrip ("\\ n" )
192
-
182
+ if not isinstance (data , str ):
183
+ # Safely return empty string if input is not a valid string
184
+ return ""
185
+
186
+ if settings .CUSTOM_INJECTION_MARKER is not None :
187
+ lines = []
188
+ for line in data .split ("\\ n" ):
189
+ if not line .startswith (settings .ACCEPT ) and settings .CUSTOM_INJECTION_MARKER_CHAR in line :
190
+ if menu .options .test_parameter is not None and settings .CUSTOM_INJECTION_MARKER is False :
191
+ line = remove_tags (line )
192
+ line = line .replace (settings .CUSTOM_INJECTION_MARKER_CHAR , settings .ASTERISK_MARKER )
193
+ lines .append (line )
194
+
195
+ # Remove duplicates, then rejoin lines
196
+ data = "\\ n" .join (list (dict .fromkeys (lines ))).rstrip ("\\ n" )
197
+
193
198
return data
194
199
195
200
"""
0 commit comments