Skip to content

Conversation

Legend-Master
Copy link
Contributor

@Legend-Master Legend-Master commented Sep 2, 2024

Url deserializes Windows drive letter to url scheme which is not what we wanted, since we don't use single letter schemes anyways, we can just assume a single letter scheme url to be a path not a url

Fix #1704

Copy link
Contributor

github-actions bot commented Sep 2, 2024

Package Changes Through 3c53ac6

There are 3 changes which include dialog with prerelease, window-state with prerelease, fs with prerelease

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.0-rc.2 2.0.0-rc.3
fs 2.0.0-rc.1 2.0.0-rc.2
dialog 2.0.0-rc.3 2.0.0-rc.4
http 2.0.0-rc.1 2.0.0-rc.2
persisted-scope 2.0.0-rc.1 2.0.0-rc.2
window-state 2.0.0-rc.2 2.0.0-rc.3

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master Legend-Master marked this pull request as ready for review September 2, 2024 06:31
@Legend-Master Legend-Master requested a review from a team as a code owner September 2, 2024 06:31
Path(SafePathBuf),
}

impl<'de> serde::Deserialize<'de> for SafeFilePath {
Copy link
Member

@amrbashir amrbashir Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that we have a duplicated enum definition with and now same deserialize implementation, maybe we can combine this logic into one, by using generics? and still export aliases without a generic:

enum FilePathOrUrl<T: FromStr> {
    Url(url::Url),
    Path(T),
}
pub type SafeFilePath = FilePath<SafeFilePath>;
pub type FilePath = FilePath<PathBuf>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum FilePathOrUrl<T: FromStr> {
    Url(url::Url),
    Path(T),
}
pub type SafeFilePath = FilePath<SafeFilePath>;
pub type FilePath = FilePath<PathBuf>;

I'm not sure how that'll work, SafeFilePath doesn't implement FromStr, and that means we either need to do it in tauri or we need a wrapper

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best is to implement FromStr on in tauri. For now, we can just add a TODO then or merge as is.

@amrbashir
Copy link
Member

Also I think we should add some tests in this PR, just to ensure we don't regress again

@amrbashir amrbashir merged commit f7280c8 into tauri-apps:v2 Sep 2, 2024
31 checks passed
@Legend-Master Legend-Master deleted the fs-windows-path branch September 2, 2024 15:24
Sir-Thom pushed a commit to Sir-Thom/plugins-workspace that referenced this pull request Oct 22, 2024
* Fix fs can't use Windows path

* Add change file

* Implement `Deserialize` instead

* Rename FilePath's visitor to FilePathVisitor

* Add todo and test

* Clippy

* Unused variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug][fs][v2] unable to get path from XX

2 participants