Skip to content

Commit

Permalink
fix: terminate uri list with CRLF
Browse files Browse the repository at this point in the history
  • Loading branch information
nik012003 committed Apr 27, 2024
1 parent afc787c commit d47d933
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "ripdrag"
authors = ["Nicola Guerrera <guerrera.nicola@gmail.com>"]
description = "Drag and Drop files to and from the terminal"
version = "0.4.7"
version = "0.4.8"
readme = "README.md"
repository = "https://github.com/nik012003/ripdrag"
edition = "2021"
Expand Down
14 changes: 7 additions & 7 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ pub fn generate_file_model() -> ListStore {
pub fn generate_content_provider<'a>(
paths: impl IntoIterator<Item = &'a String>,
) -> Option<ContentProvider> {
let bytes = Bytes::from_owned(
paths
let mut uri_list = paths
.into_iter()
.cloned()
.collect::<Vec<String>>()
.join("\n")
);

if bytes.is_empty() {
None
.join("\r\n");

if uri_list.is_empty() {
return None
} else {
uri_list += "\r\n";
let bytes = Bytes::from(uri_list.as_bytes());
Some(ContentProvider::for_bytes("text/uri-list", &bytes))
}
}
Expand Down

0 comments on commit d47d933

Please sign in to comment.