mirror of
https://github.com/KohakuBlueleaf/KohakuHub.git
synced 2026-05-05 20:07:37 -05:00
[PR #12] Fix/upload #13
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/KohakuBlueleaf/KohakuHub/pull/12
Author: @MigoXV
Created: 3/17/2026
Status: 🔄 Open
Base:
main← Head:fix/upload📝 Commits (4)
1282875feat(api): enhance commit and file handling with new endpoints and optimizationsbc2a7a8feat(commit): add commit date formatting for huggingface_hub compatibility81795acfix(history): remove unused 'formatted' field in commit response41d5025feat(huggingface): normalize commit hashes to 40 characters for compatibility📊 Changes
9 files changed (+563 additions, -134 deletions)
View changed files
📝
docs/api/huggingface-compatible.md(+7 -3)📝
src/kohakuhub/README.md(+1 -0)📝
src/kohakuhub/api/commit/routers/history.py(+18 -16)📝
src/kohakuhub/api/files.py(+81 -4)📝
src/kohakuhub/api/repo/routers/info.py(+4 -3)📝
src/kohakuhub/api/repo/routers/tree.py(+176 -108)📝
src/kohakuhub/api/repo/utils/hf.py(+30 -0)➕
tests/conftest.py(+11 -0)➕
tests/test_hf_commit_hash_compat.py(+235 -0)📄 Description
This pull request introduces several improvements to HuggingFace Hub compatibility in KohakuHub, focusing on commit hash normalization, response formatting, and expanded API endpoints. The most important changes include normalizing commit hashes to 40-character hexadecimal values on HF-compatible surfaces, updating documentation and response headers, and adding new endpoints for path information. These updates ensure better interoperability with HuggingFace clients and improve error handling and metadata consistency.
HuggingFace Compatibility & Commit Hash Normalization:
format_hf_commit_hashused throughout). [1] [2] [3] [4] [5]API Response & Metadata Improvements:
siblingsandfilesfields with HuggingFace-compatible file lists, including LFS metadata. [1] [2]Error Handling & Path Info Endpoints:
hf_entry_not_foundhandling. [1] [2]/paths-info/{revision}to support query-string based path info requests, improving compatibility with HF clients. [1] [2]Codebase & Utility Enhancements:
These changes collectively improve HuggingFace compatibility, metadata accuracy, and error handling in KohakuHub.This pull request introduces several improvements to the repository API, focusing on compatibility with HuggingFace Hub, enhanced file and path handling, and improved commit and revision metadata. The changes include new utility functions, refactoring of endpoints for better code reuse, and more robust error handling for path and entry lookups.
HuggingFace Compatibility & Metadata Improvements:
_format_commit_dateutility to standardize commit timestamps for HuggingFace compatibility inhistory.py.siblingsmetadata, including LFS file handling, and updated the response to include bothsiblingsandfiles. [1] [2] [3]Path and Entry Handling Enhancements:
normalize_repo_pathandpath_exists_in_revisionutilities to standardize path handling and check for file/directory existence at a given revision.API Endpoint Refactoring & Code Reuse:
paths-infoendpoints to use a shared implementation (get_paths_info_impl), supporting both POST and GET methods for better compatibility and maintainability. [1] [2] [3]Commit Listing Response Simplification:
Minor Improvements:
These changes collectively improve HuggingFace compatibility, error handling, and code maintainability in the repository API.# Pull Request
What changed?
Why?
Fixes #
Testing
Checklist
Screenshots
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.