Browse Source

Fix broken download link due to moved URL functions

timvisee 7 years ago
parent
commit
1f516d0dcb
1 changed files with 8 additions and 0 deletions
  1. 8 0
      api/src/file/remote_file.rs

+ 8 - 0
api/src/file/remote_file.rs

@@ -1,6 +1,7 @@
 extern crate chrono;
 extern crate regex;
 
+use api::url::UrlBuilder;
 use url::{
     ParseError as UrlParseError,
     Url,
@@ -174,6 +175,13 @@ impl RemoteFile {
     pub fn set_owner_token(&mut self, token: Option<String>) {
         self.owner_token = token;
     }
+
+    /// Build the download URL of the given file.
+    /// This URL is identical to the share URL, a term used in this API.
+    /// Set `secret` to `true`, to include it in the URL if known.
+    pub fn download_url(&self, secret: bool) -> Url {
+        UrlBuilder::download(&self, secret)
+    }
 }
 
 #[derive(Debug, Fail)]