diff --git a/CHANGELOG.md b/CHANGELOG.md index 84dfe251..e2fec647 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): ## [Unreleased] +### Fixed + +- Account for URL covariance in `Url:join()` ([#3514]) + ## [v26.1.4] ### Added @@ -1583,3 +1587,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): [#3477]: https://github.com/sxyazi/yazi/pull/3477 [#3482]: https://github.com/sxyazi/yazi/pull/3482 [#3494]: https://github.com/sxyazi/yazi/pull/3494 +[#3514]: https://github.com/sxyazi/yazi/pull/3514 diff --git a/yazi-binding/src/url.rs b/yazi-binding/src/url.rs index 44af8778..41da1ef6 100644 --- a/yazi-binding/src/url.rs +++ b/yazi-binding/src/url.rs @@ -2,7 +2,7 @@ use std::ops::Deref; use mlua::{AnyUserData, ExternalError, ExternalResult, FromLua, IntoLua, Lua, MetaMethod, UserData, UserDataFields, UserDataMethods, UserDataRef, Value}; use yazi_fs::{FsHash64, FsHash128, FsUrl}; -use yazi_shared::{path::{PathLike, StripPrefixError}, scheme::SchemeCow, strand::{StrandLike, ToStrand}, url::{AsUrl, UrlCow, UrlLike}}; +use yazi_shared::{path::{PathLike, StripPrefixError}, scheme::{SchemeCow, SchemeLike}, strand::{StrandLike, ToStrand}, url::{AsUrl, UrlCow, UrlLike}}; use crate::{Path, Scheme, cached_field, deprecate}; @@ -121,7 +121,7 @@ impl Url { Value::String(s) => { let b = s.as_bytes(); let (scheme, path) = SchemeCow::parse(&b)?; - if scheme == self.scheme() { + if scheme.covariant(self.scheme()) { Self::new(self.try_join(path).into_lua_err()?).into_lua(lua) } else { Self::new(UrlCow::try_from((scheme, path))?).into_lua(lua) @@ -129,7 +129,7 @@ impl Url { } Value::UserData(ref ud) => { let url = ud.borrow::()?; - if url.scheme() == self.scheme() { + if url.scheme().covariant(self.scheme()) { Self::new(self.try_join(url.loc()).into_lua_err()?).into_lua(lua) } else { Ok(other)