Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## `1.1.5` (2022-02-23)

### Bug Fixes
- Fix panic when query sector size

## `1.1.4` (2022-02-13)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ From [Release Page](https://github.com/ZingerLittleBee/server_bee-backend/releas
```bash
# tips: download the corresponding version according to the system architecture
# macOS
wget https://github.com/ZingerLittleBee/server_bee-backend/releases/download/v1.1.3/serverbee-deploy-x86_64-apple-darwin.zip
wget https://github.com/ZingerLittleBee/server_bee-backend/releases/download/v1.1.5/serverbee-deploy-x86_64-apple-darwin.zip
unzip serverbee-deploy-x86_64-apple-darwin.zip

# Linux
wget https://github.com/ZingerLittleBee/server_bee-backend/releases/download/v1.1.3/serverbee-deploy-x86_64-unknown-linux-musl.zip
wget https://github.com/ZingerLittleBee/server_bee-backend/releases/download/v1.1.5/serverbee-deploy-x86_64-unknown-linux-musl.zip
unzip serverbee-deploy-x86_64-unknown-linux-musl.zip

# default port is 9527
Expand Down
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ iOS 应用 [ServerBee](https://apps.apple.com/us/app/serverbee/id6443553714) 的
```bash
# 注意根据系统架构下载对应版本
# macOS
wget https://github.com/ZingerLittleBee/server_bee-backend/releases/download/v1.1.3/serverbee-deploy-x86_64-apple-darwin.zip
wget https://github.com/ZingerLittleBee/server_bee-backend/releases/download/v1.1.5/serverbee-deploy-x86_64-apple-darwin.zip
unzip serverbee-deploy-x86_64-apple-darwin.zip

# Linux
wget https://github.com/ZingerLittleBee/server_bee-backend/releases/download/v1.1.3/serverbee-deploy-x86_64-unknown-linux-musl.zip
wget https://github.com/ZingerLittleBee/server_bee-backend/releases/download/v1.1.5/serverbee-deploy-x86_64-unknown-linux-musl.zip
unzip serverbee-deploy-x86_64-unknown-linux-musl.zip

# 默认端口是 9527
Expand Down
2 changes: 1 addition & 1 deletion deploy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "serverbee-deploy"
version = "1.1.4"
version = "1.1.5"
edition = "2021"

[features]
Expand Down
2 changes: 1 addition & 1 deletion web/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "serverbee-web"
version = "1.1.4"
version = "1.1.5"
edition = "2021"

[features]
Expand Down
29 changes: 23 additions & 6 deletions web/src/system_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,32 @@ impl SystemInfo {
io::Read,
};
let mut map = HashMap::new();
let block_paths = read_dir("/sys/block").unwrap();
for path in block_paths {
let path = path.unwrap().path();
let mut file = File::open(path.join("queue/hw_sector_size")).unwrap();

let block_paths;

let read_block = read_dir("/sys/block");

if read_block.is_ok() {
block_paths = read_block.unwrap();

Check warning

Code scanning / clippy

called `unwrap` on `read_block` after checking its variant with `is_ok`

called `unwrap` on `read_block` after checking its variant with `is_ok`
} else {
return map;
}

for block_path in block_paths {
let path = block_path.unwrap().path();
let mut file = if let Ok(file) = File::open(path.join("queue/hw_sector_size")) {
file
} else {
continue;
};
let mut sector_size = String::new();
file.read_to_string(&mut sector_size).unwrap();
match file.read_to_string(&mut sector_size) {
Ok(_) => {},
Err(_) => continue
}
map.insert(
path.file_name().unwrap().to_str().unwrap().to_string(),
sector_size.trim().parse::<u16>().unwrap(),
sector_size.trim().parse::<u16>().unwrap_or(512),
);
}
map
Expand Down