diff options
Diffstat (limited to 'server/src/routes/stream.rs')
-rw-r--r-- | server/src/routes/stream.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/server/src/routes/stream.rs b/server/src/routes/stream.rs index ecfa3e7..756c502 100644 --- a/server/src/routes/stream.rs +++ b/server/src/routes/stream.rs @@ -54,7 +54,7 @@ pub async fn r_stream( spec: StreamSpec, ) -> Result<Either<StreamResponse, RedirectResponse>, MyError> { let node = T_NODE - .get(&db, id)? + .get(db, id)? .only_if_permitted(&session.user.permissions) .ok_or(anyhow!("node does not exist"))?; let source = node @@ -86,7 +86,7 @@ pub async fn r_stream( .ok_or(anyhow!("no credentials on the server-side"))?; info!("creating session on {host}"); - let instance = federation.get_instance(&host)?.to_owned(); + let instance = federation.get_instance(host)?.to_owned(); let session = instance .login(CreateSessionParams { username: username.to_owned(), @@ -116,12 +116,12 @@ pub async fn r_stream( range .as_ref() .map(|r| r.to_cr_hv()) - .unwrap_or(format!("none")) + .unwrap_or("none".to_string()) ); let urange = match &range { Some(r) => { - let r = r.0.get(0).unwrap_or(&(None..None)); + let r = r.0.first().unwrap_or(&(None..None)); r.start.unwrap_or(0)..r.end.unwrap_or(isize::MAX as usize) } None => 0..(isize::MAX as usize), @@ -192,14 +192,8 @@ impl RequestRange { assert_eq!(self.0.len(), 1); format!( "bytes {}-{}/*", - self.0[0] - .start - .map(|e| format!("{e}")) - .unwrap_or(String::new()), - self.0[0] - .end - .map(|e| format!("{e}")) - .unwrap_or(String::new()) + self.0[0].start.map(|e| e.to_string()).unwrap_or_default(), + self.0[0].end.map(|e| e.to_string()).unwrap_or_default() ) } pub fn from_hv(s: &str) -> Result<Self> { |