mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
fix: account for URL covariance in Url:join() (#3514)
This commit is contained in:
parent
3c39a326ab
commit
c9327ca851
2 changed files with 8 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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::<Self>()?;
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue