Skip to content

fix(marketplace): replace DefaultHasher with stable hash for source IDs #142

@HayWolf

Description

@HayWolf

来源

PR #136 review 评估后续跟进项

问题

marketplace_source_id 使用 DefaultHasher 对 URL 做 hash 生成持久化 source ID。Rust 文档明确说明 DefaultHasher 输出不保证跨版本稳定。升级 Rust 工具链后已有 marketplace source 和缓存数据将不可达。

当前代码

pub(super) fn marketplace_source_id(url: &str) -> String {
let mut hasher = std::collections::hash_map::DefaultHasher::new();
url.hash(&mut hasher);
format!("{:x}", hasher.finish())
}

建议

sha2 已在传递依赖树中可用。可替换为 SHA-256 或改用 URL slug 作为确定性 ID。

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