Skip to content

Commit dde11cf

Browse files
bakerboy448claude
andcommitted
Fix duplicate IDs and removal reason display consistency
- Reorder regex patterns to extract comment IDs before post IDs, fixing duplicate ID issue - Fix display logic to use action.details consistently with storage logic - Ensures removal reasons show properly in wiki output 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent effc9cd commit dde11cf

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

modlog_wiki_publisher.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -733,16 +733,16 @@ def extract_content_id_from_permalink(permalink):
733733
return None
734734

735735
import re
736-
# Extract post ID from URLs like /comments/abc123/ or https://reddit.com/comments/abc123/
737-
post_match = re.search(r'/comments/([a-zA-Z0-9]+)/', permalink)
738-
if post_match:
739-
return f"t3_{post_match.group(1)}"
740-
741-
# Extract comment ID from URLs like /comments/abc123/comment/def456/
736+
# Check for comment ID first - URLs like /comments/abc123/title/def456/
742737
comment_match = re.search(r'/comments/[a-zA-Z0-9]+/[^/]*/([a-zA-Z0-9]+)/?', permalink)
743738
if comment_match:
744739
return f"t1_{comment_match.group(1)}"
745740

741+
# Extract post ID from URLs like /comments/abc123/ (only if no comment ID found)
742+
post_match = re.search(r'/comments/([a-zA-Z0-9]+)/', permalink)
743+
if post_match:
744+
return f"t3_{post_match.group(1)}"
745+
746746
return None
747747

748748
def format_modlog_entry(action, config: Dict[str, Any]) -> Dict[str, str]:
@@ -755,8 +755,8 @@ def format_modlog_entry(action, config: Dict[str, Any]) -> Dict[str, str]:
755755
parsed_mod_note = ''
756756
if hasattr(action, 'mod_note') and action.mod_note:
757757
parsed_mod_note = str(action.mod_note).strip()
758-
elif hasattr(action, 'description') and action.description:
759-
parsed_mod_note = str(action.description).strip()
758+
elif hasattr(action, 'details') and action.details:
759+
parsed_mod_note = str(action.details).strip()
760760

761761
# Process details like main branch
762762
if hasattr(action, 'details') and action.details:

0 commit comments

Comments
 (0)