Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

logic error #112

@Sokolovskyyy

Description

@Sokolovskyyy

Describe the bug
When a plugin performs case-insensitive str.replace or re.sub(..., flags=re.IGNORECASE) for a single ASCII or Cyrillic letter, the resulting text receives double the expected replacements, i.e. one “r/р” becomes “RRRR” instead of “RR”.

To Reproduce
Steps to reproduce the behavior:
0. write your vibe-pligin

  1. Install plugin
  2. Enable the plugin
  3. Send any message containing the letter
  4. Observe the sent text: every single letter is replaced by four letters. (letter depends on the content of the code, explanation below)
from base_plugin import BasePlugin, HookResult, HookStrategy

__id__ = "bug_demo"
__name__ = "Bug Demo"
__version__ = "1.0"

class Plugin(BasePlugin):
    def on_plugin_load(self):
        self.add_on_send_message_hook(100)

    def on_send_message_hook(self, account, params):
        if params.message:
            # This single line reproduces the bug
            params.message = params.message.replace('a', 'aa').replace('b', 'bb') \
            return HookResult(strategy=HookStrategy.MODIFY, params=params)
        return HookResult()

Expected behavior
A clear and concise description of what you expected to happen.
expected:
apple -> aaple, broke -> bbroke:
real:
apple -> aaaaple, broke -> bbbbroke

Screenshots
If applicable, add screenshots to help explain your problem.
no need

Smartphone (please complete the following information):
OnePlus 7 crdroid 11.6 Android 15

Additional context
Add any other context about the problem here.
The issue occurs only when the built-in Python runtime (Chaquopy) is used.
Work-around: avoid chained str.replace / re.sub with IGNORECASE ; instead use a single case-sensitive replace for each case. This suggests the runtime internally applies the replacement twice under case-insensitive conditions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions