MCPcopy Create free account
hub / github.com/apache/solr / _sanitize_issue_id

Method _sanitize_issue_id

dev-tools/scripts/changes2logchange.py:364–381  ·  view source on GitHub ↗

Sanitize issue ID while preserving uppercase letters and # for readability. Examples: SOLR-12345, LUCENE-1234, PR#3758, GITHUB#2408, v9.8.0-entry-001

(issue_id: str)

Source from the content-addressed store, hash-verified

362
363 @staticmethod
364 def _sanitize_issue_id(issue_id: str) -> str:
365 """
366 Sanitize issue ID while preserving uppercase letters and # for readability.
367 Examples: SOLR-12345, LUCENE-1234, PR#3758, GITHUB#2408, v9.8.0-entry-001
368 """
369 # Replace unsafe characters with dash (preserving case)
370 sanitized = SlugGenerator.UNSAFE_CHARS_PATTERN.sub('-', issue_id)
371
372 # Replace remaining unsafe characters (but keep letters/numbers/dash/hash/dot)
373 sanitized = re.sub(r'[^a-zA-Z0-9.#-]+', '-', sanitized)
374
375 # Replace multiple consecutive dashes with single dash
376 sanitized = re.sub(r'-+', '-', sanitized)
377
378 # Strip leading/trailing dashes
379 sanitized = sanitized.strip('-')
380
381 return sanitized
382
383 @staticmethod
384 def _sanitize_filename_part(text: str) -> str:

Callers 1

generate_slugMethod · 0.80

Calls 2

stripMethod · 0.80
subMethod · 0.45

Tested by

no test coverage detected