Skip to content

Commit 5c8fa12

Browse files
committed
chore: release 3.27.0
1 parent e34e574 commit 5c8fa12

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## 3.27.0
4+
5+
This release adds `TempPath::try_from_path` and deprecates `TempPath::from_path`.
6+
7+
Prior to this release, `TempPath::from_path` made no attempts to convert relative paths into absolute paths. The following code would have deleted the wrong file:
8+
9+
```rust
10+
let tmp_path = TempPath::from_path("foo")
11+
std::env::set_current_dir("/some/other/path").unwrap();
12+
drop(tmp_path);
13+
```
14+
15+
Now:
16+
17+
1. `TempPath::from_path` will attempt to convert relative paths into absolute paths. However, this isn't always possible as we need to call `std::env::current_dir`, which can fail. If we fail to convert the relative path to an absolute path, we simply keep the relative path.
18+
2. The `TempPath::try_from_path` behaves exactly like `TempPath::from_path`, except that it returns an error if we fail to convert a relative path into an absolute path (or if the passed path is empty).
19+
20+
Neither function attempt to verify the existence of the file in question.
21+
22+
Thanks to @meng-xu-cs for reporting this issue.
23+
324
## 3.26.0
425

526
- Support `NamedTempFile::persist` on RedoxOS (#393) (thanks to @Andy-Python-Programmer).

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tempfile"
3-
version = "3.26.0"
3+
version = "3.27.0"
44
authors = [
55
"Steven Allen <steven@stebalien.com>",
66
"The Rust Project Developers",

0 commit comments

Comments
 (0)