fix: the path to join is shadowed by a local variable (#1322) (#1335)

* fix: the path to join is shadowed by a local variable

* fix: redact target uri
This commit is contained in:
Myriad-Dreamin 2025-02-20 00:50:10 +08:00 committed by GitHub
parent cb51d67e7d
commit 9904189910
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 49 additions and 2 deletions

View file

@ -17,6 +17,7 @@ use typst::syntax::VirtualPath;
use super::TypstFileId;
#[derive(Debug)]
pub enum PathResolution {
Resolved(PathBuf),
Rootless(Cow<'static, VirtualPath>),
@ -39,7 +40,7 @@ impl PathResolution {
pub fn join(&self, path: &str) -> FileResult<PathResolution> {
match self {
PathResolution::Resolved(path) => Ok(PathResolution::Resolved(path.join(path))),
PathResolution::Resolved(root) => Ok(PathResolution::Resolved(root.join(path))),
PathResolution::Rootless(root) => {
Ok(PathResolution::Rootless(Cow::Owned(root.join(path))))
}