Skip to content

Fix: Empty lines in URL_config.ini cause top-most records to be silently deleted#1408

Open
HeatCrab wants to merge 1 commit into
ihmily:mainfrom
HeatCrab:fix-config-delete-bug
Open

Fix: Empty lines in URL_config.ini cause top-most records to be silently deleted#1408
HeatCrab wants to merge 1 commit into
ihmily:mainfrom
HeatCrab:fix-config-delete-bug

Conversation

@HeatCrab

Copy link
Copy Markdown

📜 标题(Title)

请提供这个Pull Request中提议的更改的简洁描述:

  • Fix: Empty lines in URL_config.ini cause top-most records to be silently deleted

🔍 描述(Description)

请描述这个PR做了什么/为什么这些更改是必要的:

  • When URL_config.ini contains empty lines (e.g., used to visually separate platform categories), the program reads them as \n. In main.py, the delete_line() method incorrectly uses substring matching (del_line in txt_line) to check for deletion.
  • Since the newline character \n is present in every line, this logic evaluates to True for the very first line of the configuration file. As a result, every empty line causes the top-most valid URL configuration to be wrongly and silently deleted.
  • This PR changes the substring matching to exact matching (del_line == txt_line), which perfectly resolves the data loss issue without any side effects.

📝 类型(Type of Change)

这个PR引入了哪种类型的更改?(请勾选所有适用的选项)

  • 修复Bug
  • 新功能
  • 代码风格更新(格式化,局部变量)
  • 重构(改进代码结构)
  • 构建相关更改(依赖项,构建脚本等)
  • 其他:请描述

🏗️ 测试(Testing)

请描述您已经进行的测试:

  • Tested locally with multiple empty lines and duplicate entries in URL_config.ini. Verified that valid stream URLs are no longer deleted and duplicates are correctly removed.

如果适用,请提供测试更改的说明:

  • Add empty lines to config/URL_config.ini and run the script. The script should not delete the topmost valid configurations anymore.

📋 检查清单(Checklist)

在您创建这个PR之前,请确保以下所有框都被勾选,方法是在每个框中放置一个x

  • 我已经阅读了贡献指南文档
  • 我的更改没有产生新的警告
  • 我已经添加了覆盖我更改的测试
  • 我已经相应地更新了文档(如果适用)
  • 我遵循了这个项目的代码风格

注意: 这个PR在所有复选框被勾选之前不会被合并。


感谢您的贡献!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant