-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement URI encoding and decoding for filenames #9
Comments
I just found there's a library developed by @johnstonskj that may work for this ticket. |
I've applied a patch that uses the pct-str library. It follows the RFC 3986. It shows that 2396 has been deprecated. The Freedesktop Trash spec still shows RFC 2396 as the required spec for path encoding, but I'm guessing that info will be updated. One difference with the 3986 spec is that slashes are escaped now. Here's the resulting Trash Info file with the patch applied, after I run
|
I think best to stick with the Freedesktop trash spec, using 2396. We can still use the pct_str library; there's an example here for customizing the reserved and unreserved characters: |
I think best to forget about using a library and just convert to Rust the three functions mentioned in the first post. |
Resolved in #10 Thank you @Jammyjamjamman ! |
When the absolute path and filename is written to a .trashinfo file, the string should be encoded per RFC2396.
Conversely, the string will need to be decoded when restoring the file (#5).
This already happens for the C version of rmw. Here are the relevant functions that it uses:
is_unreserved()
https://github.com/theimpossibleastronaut/rmw/blob/94d19a0017b4d749a03baf6277f4f983a1dcfb3a/src/utils_rmw.c#L190-L220
escape_url()
https://github.com/theimpossibleastronaut/rmw/blob/94d19a0017b4d749a03baf6277f4f983a1dcfb3a/src/utils_rmw.c#L223-L280
unescape_url()
https://github.com/theimpossibleastronaut/rmw/blob/94d19a0017b4d749a03baf6277f4f983a1dcfb3a/src/utils_rmw.c#L283-L336
The text was updated successfully, but these errors were encountered: