Skip to content

Commit f3ef493

Browse files
egor-tensinw4
authored andcommitted
In plaintext mode, end with a newline
A curl call like curl -X PUT --data-binary @data.txt https://host/ outputs the paste URL without a newline a-la https://host/somepastenamewhich can mess up the terminal prompt. I don't really see the downside of adding a newline. The workflow of url="$( curl -X PUT --data-binary @data.txt https://host/ )" curl "$url" still works, since the shell strips the newline in command substitutions.
1 parent 6e29e25 commit f3ef493

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ async fn submit_raw(
112112
) -> Result<String, Error> {
113113
let id = generate_id();
114114
let uri = if let Some(Ok(host)) = host.0.as_ref().map(|v| std::str::from_utf8(v.as_bytes())) {
115-
format!("https://{host}/{id}")
115+
format!("https://{host}/{id}\n")
116116
} else {
117-
format!("/{id}")
117+
format!("/{id}\n")
118118
};
119119

120120
store_paste(&store, id, data);

0 commit comments

Comments
 (0)