Files
markbase/docs/EMPTY_DIRECTORY_GUIDE.md
Warren 1300a4e223
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
MarkBase架构升级:Multi-Volume Virtual Tree + Dual-View Management + Git Remote修正
核心功能:
-  Categories/Series双视图管理(category_view.rs + import_markdown.rs)
-  FUSE Multi-Volume支持(tree_type参数)
-  SSH/SFTP/SCP/rsync协议完整实现(4042行)
-  NFS/SMB Module Phase 1-3完成
-  Archive Module Phase 1-4完成(2916行)
-  Download Center API完整实现
-  S3兼容API实现(560行)

Git配置修正:
-  删除错误origin(gitea.momentry.ddns.net)
-  删除m5max128(指向机器名)
-  设置origin = m5max128gitea.momentry.ddns.net/admin/markbase
-  设置m4minigitea = m4minigitea.momentry.ddns.net/warren/markbase

数据清理:
-  删除38个临时SQLite(保留accusys.sqlite、demo.sqlite)
-  删除.bak、test_*.bin、调试脚本等临时文件
-  删除临时目录(build/、download files/、raid_test/等)
-  更新.gitignore排除临时文件

架构优化:
- 52个文件修改,2434行新增,4739行删除
- Workspace成员整合(16个crate)
- 数据库状态:accusys.sqlite保留(主demo测试)

远程同步:
-  准备推送到m5max128gitea(远程Gitea)
-  准备推送到m4minigitea(本地Gitea)
2026-06-12 12:59:54 +08:00

127 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Empty Directory Upload Guide
## Problem
webkitdirectory浏览器行为限制**无法上传空目录**
浏览器只选择**文件**空目录不会被包含在fileInput.files中。
## Solutions
### Solution 1: Empty File Marker (Recommended)
**Add `.keep` or `.gitkeep` in every empty directory:**
```bash
# Before upload, add empty files in empty directories
find /path/to/upload -type d -empty -exec touch {}/.keep \;
# This ensures all directories will be uploaded
```
**Example structure:**
```
ExaSAN-DAS/
├── ExaSAN-Carry-12/
│ ├── System_Code.bin
│ └── Boot_Code.bin
├── EmptyFolder1/
│ └── .keep (0 bytes, ensures directory upload)
└── EmptyFolder2/
├── SubEmptyFolder/
│ └── .keep (nested empty directory)
└── .keep
```
### Solution 2: Manual Creation
**Upload files first, then create empty directories:**
```bash
# 1. Upload all files with webkitdirectory
# 2. Find empty directories in source
find /path/to/source -type d -empty > empty_dirs.txt
# 3. Create in destination
while read dir; do
relative=${dir#/path/to/source/}
mkdir -p "/Users/accusys/Downloads/accusys/$relative"
done < empty_dirs.txt
```
### Solution 3: Script Automation
**Automated script for empty directory handling:**
```bash
#!/bin/bash
# prepare_upload.sh - Prepare directory for upload
SOURCE_DIR="$1"
echo "=== Preparing upload for $SOURCE_DIR ==="
# Add .keep in all empty directories
find "$SOURCE_DIR" -type d -empty | while read dir; do
touch "$dir/.keep"
echo "Added .keep in: $dir"
done
echo "=== Preparation complete ==="
echo "Empty directories now have .keep files"
echo "Ready for webkitdirectory upload"
```
**Usage:**
```bash
# Prepare before upload
bash scripts/prepare_upload.sh /path/to/ExaSAN-DAS
# Then upload using webkitdirectory
# All empty directories will be uploaded with .keep files
```
## MarkBase Upload Service Status
**Current Support:**
- ✅ Empty files (0 bytes): `.localized`, `.keep`, `.gitkeep`
- ✅ Subdirectory creation: Automatic `create_dir_all(parent)`
- ✅ Multi-level paths: `subfolder/deeper/file.txt`
- ❌ Empty directories: Browser limitation (use `.keep` workaround)
## Best Practice
**For 290 files upload:**
1. **Prepare source directory:**
```bash
bash scripts/prepare_upload.sh /path/to/AccuSys Downloads
```
2. **Upload via webkitdirectory:**
- Open https://download.accusys.ddns.net/upload
- Select entire folder
- All files + `.keep` files uploaded
- Directory structure preserved
3. **Verify uploaded structure:**
```bash
find /Users/accusys/Downloads/accusys -type d
```
## Implementation Notes
**MarkBase upload_unlimited API:**
- Removed `file_size == 0` validation (server.rs:1145)
- Allows empty files: `.localized`, `.keep`, `.DS_Store`
- Automatic subdirectory creation: `create_dir_all(parent)`
- SHA256 checksum for empty files: `e3b0c44298fc1c...`
**Technical limitation:**
- webkitdirectory是HTML5标准限制
- 无法通过服务器端修改绕过
- 只能通过`.keep`文件 workaround
---
**Last Updated: 2026-06-09**
**Version: 2.6 (Empty File + Empty Directory Support)**